Subject Re: [ib-support] Questions about Firebird's API
Author SD@topol.udm.net
On 13 Mar 2002 at 15:48, C R Zamana wrote:

> Some questions about Firebird's API:

I didn't work with API a lot, but my first attempts were mostly
successful. To tell the truth I didn't do it in Linux, but I hope API
isn't different between platforms.

>1) What is the correct sequence to finish a transaction using
>the functions below?
>
>isc_dsql_free_statment()

You should use isc_dsql_free_statement with DSQL_close. But if you
don't, commit/rollback will close all cursors automatically.
Commit/rollback retaining won't.
You don't need to drop the statement handle if you plan to use the
statement later. A statement handle exists and is valid until
disconnect. It will be freed automatically if you used
isc_dsql_alloc_statement2().

>2) Freeing the osqlda structure automagically frees
>the osqlda->sqlvar structure too?

If osqlda means XSQLDA then they are ONE structure - a little
header and an array of XSQLVARs. They must be placed in one
continuous memory area and have to be allocated and deallocated as a
single whole.

>3) How should I handle the osqlda->sqlvar->sqldata that
>was previously allocated? Should I free them one by one?

An sqldata is a pointer to your buffer. In spite of IB's beta
documentation, the client library doesn't allocate or free it
automatically. You should allocate memory for buffers and, of course,
free it after using.

SY, Dimitry Sibiryakov.