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