On Wednesday 22 April 2009 06:26:19 OpenDBX devel list wrote:
> I also have a test in openDBX that works PERFECT.
>
> I believe the only difference is the odbx_result_finish... but I am not
> sure...

The returned values seem to be OK. First call to odbx_result() returns 3 (rows 
available) because of the select inside the stored procedure and the next 
call to odbx_result() returns 2 (no rows available) because of the stored 
procedure itself.

The problem is how you handle the return value of 2 as you call 
odbx_row_fetch() after odbx_result() tells you that there are no rows 
available. In this case, there is no result set available and also no memory 
allocated for it so you get a parameter error (-3, result handle not correct 
for this call to odbx_row_fetch()).

Your last example works perfectly because of

while( ( err = odbx_result( handle, &result, &tv, 0 ) ) != 0 )
{
    puts("odbx_result");
    if( err < 0 )
    {
        fprintf( stderr, "odbx_result(): %s\n", odbx_error( handle, err ) );
        return err;
    }

    switch( err )
    {
        case 1:
        // NOTE: Retrieving the result is not (!) canceled
        fprintf( stdout, "odbx_result(): Timeout\n" );
        continue;

        case 2:
        fprintf( stdout, "Affected rows: %d\n", odbx_rows_affected(
result ) );
        odbx_result_free( result );
        continue;
    }

The important part is the "case 2".


Norbert
-- 
OpenPGP public key
http://www.linuxnetworks.de/norbert.pubkey.asc

Attachment: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
libopendbx-devel mailing list
libopendbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libopendbx-devel
http://www.linuxnetworks.de/doc/index.php/OpenDBX

Reply via email to