|
<< Click to Display Table of Contents >> Informix driver |
![]() ![]()
|
This topic discusses features unique to the Informix SQL Link driver.
Stored procedure support
The Informix driver supports stored procedures. Please note the following points:
1.Informix stored procedures have input parameters but no output parameters.
2.DbiOpenSPParamList returns all input parameters and sets SPParamDesc.uParamNum and SPParamDesc.szName starting from 1.
SPParamDesc[0].uParamNum = 1
SPParamDesc[0].szName = "1"
and SPParamDesc[0].eParamType = paramIN;
…
The rest of the information for SPParamDescs (such as uFldType, usubType, iUnits1, iUnits2, uOffset, uLen, and uNullOffset) must be set by user.
Retrieving SQLCA information
The Informix SQL Link driver includes an improved passthrough property that contains native SQLCA information. Users can use the drvNATIVESQLCA property with DbiGetProp to retrieve SQLCA information. SQLCA information gives detailed data on Informix server errors and exceptions. When an Informix error occurs, the Informix Global SQLCA information for that error is retrieved and retained by the SQL driver until the next time the database server is accessed. General SQLCA information is returned whenever an error hasn't occurred.
The following table shows the information that is made available.
*ppropValue |
*pilen |
SQLCA |
sizeof(struct sqlca_s) |
An example:
// Informix SQLCA structure from Informix sqlca.h header file
struct sqlca_s
{
long sqlcode;
char sqlerrm[72]; /* error message parameters */
char sqlerrp[8];
long sqlerrd[6];
/* 0 - estimated number of rows returned */
/* 1 - serial value after insert or ISAM error code */
/* 2 - number of rows processed */
/* 3 - estimated cost */
/* 4 - offset of the error into the SQL statement */
/* 5 - rowid after insert */
struct sqlcaw_s
{
char sqlwarn0; /* = W if any of sqlwarn[1-7] = W */
char sqlwarn1; /* = W if any truncation occurred or
database has transactions */
char sqlwarn2; /* = W if a null value returned or
ANSI database */
char sqlwarn3; /* = W if no. in select list != no. in into list or
turbo backend */
char sqlwarn4; /* = W if no where clause on prepared update,
delete or incompatible float format */
char sqlwarn5; /* = W if non-ANSI statement */
char sqlwarn6; /* reserved */
char sqlwarn7; /* reserved */
} sqlwarn;
};
struct sqlca_s mySqlca;
int main()
{
// Initialize engine
// Connect to database.
//get the sqlca (on no exception)
unsigned int len;
DbiGetProp(hDb,drvNATIVESQLCA, &mySqlca, sizeof(sqlca_s),
&len);
//get the sqlca (on an exception)
DbiOpenTable(hDb, "non existing table", ...)
DbiGetProp(hDb,drvNATIVESQLCA, &mySqlca, sizeof(sqlca_s),
&len);
return 0;
}
Retrieving Informix database information
The Informix SQL Link driver has three properties that you can access using DbiGetProp to determine the type of database the BDE is connected to
Property |
Type |
Description |
dbONLINE |
BOOL |
TRUE if the database connected is ONLINE type otherwise FALSE |
dbTRANALLOWED |
BOOL |
TRUE if the database connected permits transactions otherwise FALSE |
dbANSI |
BOOL |
TRUE if the database connected is ANSI type otherwise FALSE |