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 
 
Printing MySQL error message to conversation

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules
View previous topic :: View next topic  
Author Message
rpgbl



Joined: 01 Oct 2009
Posts: 30

PostPosted: Tue Jul 20, 2010 11:56    Post subject: Printing MySQL error message to conversation Reply with quote

Hi guys,

Is there any way to print the MYSQL error message when a query is wrong? So far I noticed I can catch the status of the query when SQL_ERROR is returned but I dont know how to catch the error message sent from MySQL.

Any suggestion please? Thank you.
Back to top
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Tue Jul 20, 2010 13:12    Post subject: Reply with quote

Have a look at my SQLServer plugin.
I've put full error checking (and logging) into it.
MySQL may have some special API, but the process should be the same.
Back to top
View user's profile Send private message
rpgbl



Joined: 01 Oct 2009
Posts: 30

PostPosted: Tue Jul 20, 2010 13:55    Post subject: Reply with quote

Hi Gryphyn,

Thanks for the reply. I've been using NWNX SQL include by Ingmar Stieger and it's beend working perfectly. The only things that I missed here is catching the error message.

Gryphyn, is it possible to combine your logging system with the NWNX SQL include Im using ?


ps:sorry I dont have much technical experience
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Tue Jul 20, 2010 17:39    Post subject: Reply with quote

AFAIK database errors are printed into nwnx_odbc logfile...
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
rpgbl



Joined: 01 Oct 2009
Posts: 30

PostPosted: Tue Jul 20, 2010 17:50    Post subject: Reply with quote

Ah I suppose you're right, ShaDoOoW. The file xp_mysql.txt logged all the transactions. I will try to get the error msg from here then.

Hm, so how to read a text file and put it to the conversation ? ^v^
Back to top
View user's profile Send private message
Paul R



Joined: 17 Apr 2009
Posts: 42

PostPosted: Tue Jul 20, 2010 20:25    Post subject: Reply with quote

Depending on the size use something like FileReadAll() from the system plugin (Linux) or the Windows equivalent, parse it and put it in a custom token.

Better still write a script to extract it and put it in a table, apart from you not being able to read it if there is a larger problem with the DB Smile
_________________
oops
Back to top
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Thu Jul 22, 2010 10:19    Post subject: Reply with quote

rpgbl wrote:
Hi Gryphyn,

Thanks for the reply. I've been using NWNX SQL include by Ingmar Stieger and it's beend working perfectly. The only things that I missed here is catching the error message.

Gryphyn, is it possible to combine your logging system with the NWNX SQL include Im using ?


ps:sorry I dont have much technical experience

Yes it is... (but I won't be doing it)
Currently the logging will only capture the error, but not the diagnostics.
Most of the error message are pretty useless without the extra diagnostic information.
I simply took the base code and extended it to loop though all the diagnostic messages and dump them out to the log file.
This as a function call that could be called from anywhere in the (base)class.

Cheers
Gryphyn
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules 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