View previous topic :: View next topic |
Author |
Message |
rpgbl
Joined: 01 Oct 2009 Posts: 30
|
Posted: Tue Jul 20, 2010 11:56 Post subject: Printing MySQL error message to conversation |
|
|
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 |
|
|
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Tue Jul 20, 2010 13:12 Post subject: |
|
|
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 |
|
|
rpgbl
Joined: 01 Oct 2009 Posts: 30
|
Posted: Tue Jul 20, 2010 13:55 Post subject: |
|
|
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 |
|
|
ShaDoOoW
Joined: 20 Aug 2005 Posts: 584
|
Posted: Tue Jul 20, 2010 17:39 Post subject: |
|
|
AFAIK database errors are printed into nwnx_odbc logfile... _________________ Community Patch / NWNX Patch / NWNX Files / NWNX Connect |
|
Back to top |
|
|
rpgbl
Joined: 01 Oct 2009 Posts: 30
|
Posted: Tue Jul 20, 2010 17:50 Post subject: |
|
|
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 |
|
|
Paul R
Joined: 17 Apr 2009 Posts: 42
|
Posted: Tue Jul 20, 2010 20:25 Post subject: |
|
|
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 _________________ oops |
|
Back to top |
|
|
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Thu Jul 22, 2010 10:19 Post subject: |
|
|
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 |
|
|
|