From InterBase

Go Up to API Function Reference

Prepares and executes just once, a DSQL statement that returns no more than one row of data.


ISC_STATUS isc_dsql_exec_immed2(
ISC_STATUS *status_vector,
isc_db_handle *db_handle,
isc_tr_handle *trans_handle,
unsigned short length,
char *statement,
unsigned short dialect,
XSQLDA *in_xsqlda,
XSQLDA *out_xsqlda);

Parameter Type Description



Pointer to the error status vector


isc_db_handle *

Pointer to a database handle set by a previous call to ­isc_attach_database().

db_handle returns an error in status_vector if it is NULL.


isc_tr_handle *

Pointer to a transaction handle whose value has been set by a previous isc_start_transaction() call; trans_handle returns an error if NULL.


unsigned short

Length of the DSQL statement, in bytes; set to 0 in C programs to indicate a null-terminated string.


char *

DSQL string to be executed


unsigned short

  • Indicates the SQL dialect of statement.
  • Must be less than or equal to the SQL dialect of the client.



Pointer to an optional, previously allocated XSQLDA used for input; if input parameters are not supplied, set this value to NULL.



Pointer to an optional, previously allocated XSQLDA used for results of statement execution. If not required, set this value to NULL.


isc_dsql_exec_immed2() prepares the DSQL statement specified in statement, executes it once, and discards it. statement can return a single set of values (i.e, it can be an EXECUTE PROCEDURE or singleton SELECT) in the output XSQLDA.

If statement requires input parameter values (that is, if it contains parameter ­markers), these values must be supplied in the input XSQLDA, in_xsqlda.

For statements that return multiple rows of data, use isc_dsql_prepare(), ­isc_dsql_execute2(), and isc_dsql_fetch().


The following program fragment calls isc_dsql_exec_immed2():

ISC_STATUS status_vector[20];
XSQLDA *in_xsqlda, *out_xsqlda;
char *execute_p1 = "EXECUTE PROCEDURE P1 ?";
/* Set up input and output XSQLDA structures here. */
. . .
isc_dsql_exec_immed2( status_vector,
&database_handle, /* Set in previous isc_attach_database() call.*/
&tr_handle, /* Set in previous isc_start_transaction() call. */
0, execute_p1, 1, in_xsqlda, out_xsqlda);
if (status_vector[0] == 1 && status_vector[1]) {
/* Process error. */

Return value

isc_dsql_exec_immed2() returns the second element of the status vector. Zero indicates success. A nonzero value indicates an error. For InterBase errors, the first element of the status vector is set to 1, and the second element is set to ­isc_bad_db_handle, isc_bad_trans_handle, or another InterBase error code.

To check for an InterBase error, examine the first two elements of the status vector directly. For more information about examining the status vector, see Handling Error Conditions.

For more information about creating and populating the XSQLDA, see Understanding the XSQLDA.

See Also

Advance To: