Re: Informix sqlca and Delphi
Posted in 1997
Topics: Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL, Third-Party Tools & Monitoring, Jobs, Consulting & Announcements
Marius Dreyer wrote: > > Hi evereyone > > Is somebody accessing the Informix sqlca from Delphi 1.01 ? > > The problem i'm having is to access the serial value for table into > which I just inserted a record. > > Please help > -- > ======================================================================= > > Marius G Dreyer > > Senior Consultant > > +27 231 73123 (w) > +27 231 71075 (h) > +27 231 73343 (f) > ======================================================================= This informix is from the SQL Links READLINK.TXT file. I believe the property was surfaced in Delphi as well. NEW DRIVER PROPERTY IN SQLD_IN5.DLL The Informix 5.x SQL Link driver includes an improved passthru 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 Informix SQLCA sizeof(struct sqlca_s) 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; }