[Info-ingres] OpenAPI Caling a database procedure



Hi Grant et al,

I'm trying call a database procedure synchronously from an OpenAPI
application. The procedure has no parameters, all I want is the return
value. My understanding is that I set IIapi_query to say I'm executing a
database procedure. It will not do anything until the necessary
parameters (including procedure name and owner) are supplied and
filled in.

However, the code seems to hang at the initial iiapi_query() call.

I am using in order the following:
IIapi_query()
QueryParm.qy_queryType=IIAPI_QT_EXEC_PROCEDURE;
QueryParm.qy_queryText=NULL;
QueryParm.qy_parameters=TRUE;
I don't wait on gp_completed.

IIapi_setDescriptor()
setDescParm.sd_stmtHandle=QueryParm.qy_stmtHandle;
setDescParm.sd_descriptorCount=2;

I then allocate storage for two parameter descriptors for the
array setDescParm.sd_descriptor. In each element of which I
set ds_dataType = IIAPI_CHA_TYPE,
ds_nullable = FALSE,
ds_columnType = IIAPI_COL_SVCPARM
ds_columnName = NULL

I wait on gp_completed.

IIapi_putParms()
Fill in the procedure name, owner values described above, call
the procedure an wait on gp_completed.

At this point I wait on the IIapi_query to complete.
Then I call IIapi_get_QueryInfo to pick up the procedure return value.

Martin Bowes
--
Random Farscape Quote #26:
John - I think we have to put Grandma in a home.
Ka'Dargo - We could burn her.
John - You burn your old people!
Ka'Dargo - No, but in her case...

.