[Info-ingres] OpenAPI Weirdness

DATABASE

    Sponsored Links

    Next

  • 1. [Info-ingres] Timezone change for Australia - end of daylight savings
    Hi Nigel, k1w1? Hey, would I be right in thinking your from NZ and not from OZ? What are you doing in the West Island? Ingres does not use the OS timezone files - it has its own. I found this out in 2000 when the daylight savings end point was extended by two weeks for the Sydney Olympics. That caused me way, way, way more grief than any damn spurious millenium bug! Use iizck to determine the current daylight savings start end points on your installations. If the end point does not tally with what you think it should be then you can ask IngresCorp for a patch with a new one. If memory serves correctly, it is possible to use the output from iizck to build a timezone rules file that iizic can then use to install the new rules. But its a pain in the arse as the iizic does not directly read the same format as iizck produces. You have to edit it heavily. See the man page on the OS command zic. Martin Bowes > Hi All, > The end of daylight saving time for Australia will be extended by a > week to 2/4/2006. I have a patch from Microsoft for the OS and also > an update for the HP-UX. I am currently waiting for my account to be > created on Ingres support, however wanted to know what thoughts people > have on this and the impact to Ingres - we are running both 2.6 and > 1.2 Thanks Random Duckman Quote #72: Other: Make a move & you're dead meat. Duckman: Does wetting myself count as moving?
  • 2. [Info-ingres] transactions log size
    Hi All, Does anyone have any information pertaining to if Ingres R3 uses more tr log space than 2.6... in what contexts... what % more... etc. And a follow-up question to that... We are considering increasing the size of the tr log which is currently 4 gig, to 6 or 8 gig. The only downfall of doing that which I can see is that if we have a 'runaway' process that fills up the bigger log and as a result is force-aborted, the rollback/recovery time will be longer because there is more to un-commit/rollback/recover. Do you see that as being particularly problematic in any context? Are there any other problems/issues to be concerned with, pertaining to increasing the log file size? Any info (or direction to reliable resource info) would be appreciated. Thanks lots! Grant

[Info-ingres] RE: OpenAPI Weirdness

Postby martin.bowes » Fri, 12 Aug 2005 19:40:23 GMT

Hi Grant et al,

Sorry to bother you directly Grant, but I'm at my wits end on this one 
and could use some advice. If anyone else in the newsgroup would like 
to chip in 2c worth, I'd be happy too.

I've written a C program which has a subroutine full of API stuff. This 
subroutine controls connecting to three databases in sequence to do 
stuff. From the final database connection it reads in a lot (17511 rows) 
of data to the program before disconnecting and then terminating the 
API before returning to the main program. 

All of which appears to work perfectly well. The data returned to the 
program is exactly what is in the database.

But after the IIapi_terminate succeeds, the subroutine will return a 
TRUE. Diagnostics indicates this is all happening. But the subroutine 
NEVER returns to the main program. Instead it either loops? or causes 
a coredump.

The code is literally:
main (...) {
if (Generate_Analysed_Data(&SayWhat)) {
    printf("Generate_Analysed_Data completed OK!\n");
} else {
    printf("Unexpected Error: Failed to Generate Analysed Data\n");
    printf("Program Aborts\n");
    exit (1);
    };
} /*main*/

int Generate_Analysed_Data ( ParmDetails *buf) {
... stuff ...
/* Initialise OpenAPI */
if (!Init_API(&InitParm)) {return(FALSE);};
... Lots of stuff ...
/* In all cases we an now terminate the API connection */
printf("Terminate me!\n");
if (!Terminate_API) {
    printf("Failure in API termination!\n");
    ret_value=FALSE;
    };

printf("Generate_Analysed_Data returns %d\n", ret_value);
return (ret_value);
} /*Generate_Analysed_Data*/

int Terminate_API (void) {
IIAPI_TERMPARM termParm;
IIapi_terminate(&termParm);
if ( termParm.tm_status != IIAPI_ST_SUCCESS ) {
    printf( "Open_API::Terminate_API. Error in IIapi_terminate: %d\n",
        termParm.tm_status );
    };
return termParm.tm_status;
} /*Terminate_API*/

The diagnostic output is:
Terminate me!
Generate_Analysed_Data returns 1
Segmentation fault (core dumped)


I've run in api_trace mode (5) and the trace file (1.2M) is beautiful:
grep 'status =' $II_SYSTEM/ingres/files/api_trace.log| grep -v 
SUCCESS
!IIapi_appCallback: request completed, status = NO_DATA

All the connects/disconnects are cool. All started statements are 
closed, commits are issued etc.

I've run this on II2.5 and from an II2.6 installation using vnodes back to 
the II2.5 database and the effect is the same. 

Any Ideas gratefully received. I have the core dump and dbx but I have 
no idea what I'm looking for or how to drive dbx....

Martin Bowes
Random Duckman Quote #20:
Ajax    - By the hand of Zeus what manner of deviltry is this?
          I mean... what gives?



RE: [Info-ingres] RE: OpenAPI Weirdness

Postby martin.bowes » Fri, 12 Aug 2005 22:37:22 GMT

Hi Nick et al,

tried the old 'comment things out' trick.

Finally found the problem buried three layers down. It was an array 
index going one to far, and blanking out 256 bytes it shouldn't have 
accessed.

I see C++ has an assert statement. Gee that would be useful!

This has been a remarkably profitless 2 days....

Thanks for input one and all. 

Marty
Random Farscape Quote #32:
John   - I don't believe I've left a Nuclear bomb on an elevator.
Chiana - You've done worse.


Similar Threads:

1.[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...

2.[Info-ingres] OpenAPI Status Codes

3.[Info-ingres] OpenAPI Parameter Place Holders

Hi Grant et al,

If you have a spare second or two....

Is there any difference between using the '?' place holder for an SQL 
statement and using a '~V'?

eg insert into fred values(?,?,?,?) works.

But if we change the '?' to space tilda V space. The query fails with 
either:
Illegal binarty value in query text
or
OpenAPI function cannot be called in current state.

We get the first if we set queryParm.qy_parameters=FALSE or TRUE 
respectively.

The manual suggests  these are equivalenet and hints that ~V is 
preferred - although we may be reading too much into that...

Martin Bowes
Random Duckman Quote #89:
Cornfed: I'm sorry I slapped you Duckman, but I was trying to calm you 
down.
Duckman: And I guess just saying "calm down" would be considered 
hopelessly
         simplistic!


4.[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.


<?xml  version="1.0" ?><html>
<head>
<title></title>
</head>
<body>
<div align="left"><font face="Arial"><span style="font-size:10pt">Hi Everyone,</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">As I'm just starting the joy of using API - why?Dont ask! Lets just say 
the curiosity got the better of me.</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">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....</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Now I'm struggeling to get a non select query to execute. It keeps 
bitching about an API function called in the wrong state.</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Anyone got any ideas?</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">The output from setting II_API_TRACE=5 and II_API_LOG to a suitable 
file shows:</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!IIapi_initAPI: initializing API.</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!IIapi_initialize: INGRES API initialized, envHndl = 00000001400ED020</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!IIapi_connect: connect to DBMS Server</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!IIapi_connect: envHndl = 00000001400ED020, connHndl = 
0000000000000000, tranHndl= 0000000000000000</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!IIapi_connect: target = bowtest</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!IIapi_thread(-1071947776): allocated local storage 
0000000140097840</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!IIapi_uiDispatch: dispatching event IIAPI_EV_CONNECT_FUNC</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!Dispatch(-1071947776): SQL Conn [00000001400ED220] IDLE --> 
REQ, 2 action(s)</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!Dispatch(-1071947776): action[1] REMC</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!Dispatch(-1071947776): action[2] CONN</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!IIapi_query: starting a query</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!IIapi_query: connHndl = 00000001400ED220, tranHndl = 
0000000000000000, queryType = 0</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!IIapi_query: queryText = drop table next_id</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!IIapi_uiDispatch: dispatching event IIAPI_EV_QUERY_FUNC</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt"><b>!SQL Conn Evaluate: API function called in wrong state</b></span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!Dispatch(-1071947776): SQL Conn [00000001400ED220] REQ --> 
REQ, 1 action(s)</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!Dispatch(-1071947776): action[1] CBIF</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!IIapi_appCallback: request completed, status = FAILURE</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!IIapi_getErrorInfo: retrieving errors from API</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">!IIapi_getErrorInfo: handle = 00000001400ED220</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Martin Bowes</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">--</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Random Titus Quote #0:</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Be normal and the crowd will accept you.</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Be deranged, and they'll make you their leader.</span></font></div>
<div align="left"></div>
</body>
</html>

5.[Info-ingres] OpenAPI Calling a database procedure

Hi.

If you are executing a procedure without params then sd_descriptorCount
should be 1. This could be the cause of the hang? The code below is what
I do within the PHP extension to support procedures without params. I
have tagged on the end the code for getting the return code from a
procedure. 

	queryParm.qy_genParm.gp_callback = NULL;
	queryParm.qy_genParm.gp_closure = NULL;
	queryParm.qy_connHandle = connHandle;
	queryParm.qy_tranHandle = tranHandle;
	queryParm.qy_stmtHandle = NULL;
	queryParm.qy_queryType  = IIAPI_QT_EXEC_PROCEDURE;
	queryParm.qy_parameters = TRUE;
	queryParm.qy_queryText  = NULL;

	IIapi_query(&queryParm);

	while( queryParm.qy_genParm.gp_completed == FALSE )
	    IIapi_wait( &waitParm );

	if (waitParm.wt_status != IIAPI_ST_SUCCESS)
	{
        ... handle error ...
	}

	DescrBuffer = (IIAPI_DESCRIPTOR
*)ecalloc(sizeof(IIAPI_DESCRIPTOR),1);
	setDescrParm.sd_genParm.gp_callback = NULL;
	setDescrParm.sd_genParm.gp_closure = NULL;
setDescrParm.sd_stmtHandle = stmtHandle;
	setDescrParm.sd_descriptorCount = 1; /* 	no params just
the name 
								of the
procedure */
	setDescrParm.sd_descriptor = DescrBuffer;

	setDescrParm.sd_descriptor[0].ds_dataType = IIAPI_CHA_TYPE;
	setDescrParm.sd_descriptor[0].ds_length = strlen(procname);
	setDescrParm.sd_descriptor[0].ds_nullable = FALSE;
	setDescrParm.sd_descriptor[0].ds_precision = 0;
	setDescrParm.sd_descriptor[0].ds_scale = 0;
	setDescrParm.sd_descriptor[0].ds_columnType = IIAPI_COL_SVCPARM;
	setDescrParm.sd_descriptor[0].ds_columnName = NULL;

      IIapi_setDescriptor( &setDescrParm );

	while( setDescrParm.sd_genParm.gp_completed == FALSE )
	    IIapi_wait( &waitParm );

	if (waitParm.wt_status != IIAPI_ST_SUCCESS)
	{
        ... handle error ...
	}

	DataBuffer = (IIAPI_DATAVALUE
*)calloc(sizeof(IIAPI_DATAVALUE),1);
	putParmParm.pp_genParm.gp_callback = NULL;
	putParmParm.pp_genParm.gp_closure = NULL;
	putParmParm.pp_stmtHandle = stmtHandle;
	putParmParm.pp_parmCount = setDescrParm.sd_descriptorCount;
	putParmParm.pp_parmData =  DataBuffer;
	putParmParm.pp_moreSegments = 0;

	putParmParm.pp_parmData[0].dv_null = FALSE;
	putParmParm.pp_parmData[0].dv_length = strlen(procname );
    	putParmParm.pp_parmData[0].dv_value = procname;
	IIapi_putParms( &putParmParm );

	while( putParmParm.pp_genParm.gp_completed == FALSE )
	    IIapi_wait( &waitParm );

	if (waitParm.wt_status != IIAPI_ST_SUCCESS)
	{
        ... handle error ...
	}

	getDescrParm.gd_genParm.gp_callback = NULL;
	getDescrParm.gd_genParm.gp_closure  = NULL;
	getDescrParm.gd_stmtHandle = stmtHandle;

	IIapi_getDescriptor(&getDescrParm);

	while( getDescrParm.gd_genParm.gp_completed == FALSE )
	    IIapi_wait( &waitParm );

	if (waitParm.wt_status != IIAPI_ST_SUCCESS)
	{
        ... handle error ...
	}
	getQInfoParm.gq_genParm.gp_callback = NULL;
	getQInfoParm.gq_genParm.gp_closure = NULL;
	getQInfoParm.gq_stmtHandle = queryParm.qy_stmtHandle;

	IIapi_getQueryInfo( &getQInfoParm );

	while( getQInfoParm.gq_genParm.gp_completed == FALSE )
	    IIapi_wait( &waitParm );

	if (waitParm.wt_status != IIAPI_ST_SUCCESS)
	{
        ... handle error ...
	}

	if ( getQInfoParm.gq_mask & IIAPI_GQ_PROCEDURE_RET )
	{
        /* we have a return value */

		returnvalue = getQInfoParm.gq_procedureReturn;

	}

Note if you want to return rows via a procedure a call to
IIapi_getQueryInfo() will destroy the row data being returned. I believe
the same is true for returning byref values in a procedure. I have not
worked out how to deal with this yet other than documenting it in big
neon letters.



> -----Original Message-----
> From:  XXXX@XXXXX.COM  [mailto: XXXX@XXXXX.COM ]
> Sent: Wednesday, July 13, 2005 2:53 PM
> Subject: 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...
> 
> 


6. [Info-ingres] OpenAPI Status Codes

7. [Info-ingres] OpenAPI connect - what am I missing?

8. [Info-Ingres] alter table alter column weirdness



Return to DATABASE

 

Who is online

Users browsing this forum: No registered users and 79 guest