isc_dsql_exec_immed2()
Go Up to API Function Reference
Prepares and executes just once, a DSQL statement that returns no more than one row of data.
Syntax
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 |
|
|
Pointer to a database handle set by a previous call to
|
|
|
Pointer to a transaction handle whose value has been set by a previous |
|
|
Length of the DSQL statement, in bytes; set to 0 in C programs to indicate a null-terminated string. |
|
|
DSQL string to be executed |
|
|
|
|
|
Pointer to an optional, previously allocated |
|
|
Pointer to an optional, previously allocated |
Description
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()
.
Example
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. */ isc_print_status(status_vector); return(1); }
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.