This is a discussion on RE: [Info-ingres] OpenAPI error function called in wrong state within the Ingres forums, part of the Database Server Software category; --> Martin, From the trace it looks like you are not calling IIapi_wait() to wait for the last API call ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Martin, From the trace it looks like you are not calling IIapi_wait() to wait for the last API call (IIapi_connect()) to complete. The following code should do the trick: IIAPI_GENPARM *genParm; static IIAPI_WAITPARM waitParm = { -1, /* no timeout, we don't want asynchronous queries */ 0 /* wt_status (output) */ }; while (genParm->gp_completed == FALSE) { IIapi_wait(&waitParm); } HTH grant ________________________________________ From: info-ingres-admin@cariboulake.com [mailto:info-ingres-admin@cariboulake.com] On Behalf Of martin.bowes@ctsu.ox.ac.uk Sent: Thursday, June 16, 2005 3:15 PM To: info-ingres@cariboulake.com Subject: [Info-ingres] OpenAPI error function called in wrong state Hi Everyone, As I'm just starting the joy of using API - why?Dont ask! Lets just say the curiosity got the better of me. I've managed to get a connection to the database! Yay! Well at least it claims to have connected to the database. There is no sign of a connection being started in iircp.log.... Now I'm struggeling to get a non select query to execute. It keeps bitching about an API function called in the wrong state. Anyone got any ideas? The output from setting II_API_TRACE=5 and II_API_LOG to a suitable file shows: !IIapi_initAPI: initializing API. !IIapi_initialize: INGRES API initialized, envHndl = 00000001400ED020 !IIapi_connect: connect to DBMS Server !IIapi_connect: envHndl = 00000001400ED020, connHndl = 0000000000000000, tranHndl= 0000000000000000 !IIapi_connect: target = bowtest !IIapi_thread(-1071947776): allocated local storage 0000000140097840 !IIapi_uiDispatch: dispatching event IIAPI_EV_CONNECT_FUNC !Dispatch(-1071947776): SQL Conn [00000001400ED220] IDLE --> REQ, 2 action(s) !Dispatch(-1071947776): action[1] REMC !Dispatch(-1071947776): action[2] CONN !IIapi_query: starting a query !IIapi_query: connHndl = 00000001400ED220, tranHndl = 0000000000000000, queryType = 0 !IIapi_query: queryText = drop table next_id !IIapi_uiDispatch: dispatching event IIAPI_EV_QUERY_FUNC !SQL Conn Evaluate: API function called in wrong state !Dispatch(-1071947776): SQL Conn [00000001400ED220] REQ --> REQ, 1 action(s) !Dispatch(-1071947776): action[1] CBIF !IIapi_appCallback: request completed, status = FAILURE !IIapi_getErrorInfo: retrieving errors from API !IIapi_getErrorInfo: handle = 00000001400ED220 Martin Bowes -- Random Titus Quote #0: Be normal and the crowd will accept you. Be deranged, and they'll make you their leader. |