About Store Forum Documentation Contact
Donations:
140$/mo



Post Reply 
mysql error number
Author Message
Jben Offline
Member

Post: #1
mysql error number
Hi everyone.
I have a little problem, in my database I have a procedure that is used for creating new characters if it fail it place MYSQL_ERRNO to some number. Here start my problem, how can I get this number into my program ?

Thanks in advance.
10-18-2012 08:38 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
RE: mysql error number
Hello,

I recommend using C++ function which calls many smaller SQL commands instead of one bigger SQL procedure.
It can be easier for debugging, and you'll be able to know what step returns what data.

I use following function to get message about errors (in text format) :

Code:
SQLRETURN SQL_API SQLGetDiagRecW
(
    SQLSMALLINT     fHandleType,
    SQLHANDLE       handle,
    SQLSMALLINT     iRecord,
    __out_ecount_opt(6) SQLWCHAR* szSqlState,
    SQLINTEGER*     pfNativeError,
    __out_ecount_opt(cchErrorMsgMax) SQLWCHAR* szErrorMsg,
    SQLSMALLINT     cchErrorMsgMax,
    SQLSMALLINT*    pcchErrorMsg
);

it has this parameter - SQLINTEGER* pfNativeError, (which currently I'm not using), is this what you want?
10-18-2012 01:36 PM
Find all posts by this user Quote this message in a reply
Jben Offline
Member

Post: #3
RE: mysql error number
Yes this is what I want.

I think several SQL commands help debugging, but procedures allows better encapsulation and performances while reducing traffic.
(This post was last modified: 10-18-2012 11:39 PM by Jben.)
10-18-2012 11:38 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #4
RE: mysql error number
I'll add this for next SDK
11-07-2012 09:42 PM
Find all posts by this user Quote this message in a reply
Jben Offline
Member

Post: #5
RE: mysql error number
Ok thanks.
11-20-2012 09:12 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply