logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Catch and print SQL query error

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related
View previous topic :: View next topic  
Author Message
rpgbl



Joined: 01 Oct 2009
Posts: 30

PostPosted: Mon Aug 16, 2010 14:24    Post subject: Catch and print SQL query error Reply with quote

Hi guys,

Im wondering if it is possible to catch the SQL query error and then print it in a conversation during the game.

Im using NWNX4 with mysql. Thank you.
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Mon Aug 16, 2010 21:27    Post subject: Reply with quote

Code:
if(SQLExecDirect("Your Query Here") == SQL_SUCCESS)
{
    //If the query was successful
    ...
}
else
{
    //In case of an error
    int nErrno = SQLGetErrno(); //error number as defined in nwnx_mysql_errors.nss
    string sError = SQLGetErrorMessage();
    ...
}

_________________
In Soviet Russia, NWN plays you!
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
rpgbl



Joined: 01 Oct 2009
Posts: 30

PostPosted: Thu Sep 23, 2010 20:21    Post subject: Reply with quote

Hi Virusman, thanks for the reply. I just tested it up and an error come up :

ERROR : UNDEFINED IDENTIFIER

Did I miss something here ? Anything I need to change or check ? Thank you.
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Thu Sep 23, 2010 21:39    Post subject: Reply with quote

Right.. That feature is in a -dev version of the plugin:
http://www.nwnx.org/phpBB2/viewtopic.php?p=9761#9761
_________________
In Soviet Russia, NWN plays you!
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group