Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / Informix Topics / August 2003

Tip: Looking for answers? Try searching our database.

Getting the last query when an error occured

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hobbes - 08 Aug 2003 08:17 GMT
HI !

Well, another one ! :)

Yes, once again a little question for the newsgroup !

So i begin my explanation :
with ESQL/C
As all my "C" program are services, i would like to log error to "maybe"
interact with it .
But what i'm trying to obtain unsuccessfully for some day now, is to get the
text of the last query that generates an error !

eg: in the code there is an
exec sql select a,b from alpha;

then I check the result of the command.
(b is not in the table)
so => error i got the message : "Error : Column(b) not foun in any table in
the query"

but since our whole code is pretty huge, it would be great to have the query
that make the error : "select a,b from alpha"

so we can pretty easely diagnose what the error is exactly and the gravity
of it.
In that case it's just the name of the column we can say it would take 5mn
of correction , 5 mn of compilation, and 5-10 mn of test(if we're nor
sure... :)).

we're doing this with all the database we work with.
So i think that i just missing the thing and that Informix have structure
for this....
(but i can't find information about this ... i try but i can't ...)

Thank you by advance for any answers !

Arnaud
preetinder dhaliwal - 08 Aug 2003 23:34 GMT
Well, there is one messy way-

put in an error handler in ur ec program on sqlerror

in error handler getpid from getpid c call. now query on syssessions to get ur
sessionid and with this session id, get the dump of syssqlstat. this will give
ur last sql statement , provided ur database connection has not been lost.

Rgds
Preetinder

> HI !
>
[quoted text clipped - 34 lines]
>
> Arnaud

sending to informix-list
Umberto Quaia - 29 Aug 2003 12:05 GMT
> with ESQL/C
> As all my "C" program are services, i would like to log error to "maybe"
[quoted text clipped - 23 lines]
> for this....
> (but i can't find information about this ... i try but i can't ...)

I don't know if/how that may be done via ESQL/C,
but if you have DBA access, you may try with:
1) stop program with the connection still open
2) onstat -g ses to identify the session
3) onstat -g sql <session-id> to look at last SQL code
  (hoping there is enough room for everything... ;-) )

   Umberto
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.