Re: [HELP] How to get row count?
Posted in 1995
Using ESQL/C Version 6.00.UE1 and OnLine Version 6.00.UE1 on a Sun Sparc 10 running Solaris 2.4, a more or less standard stores database, and the sample code below, I get the following output: sqlca.sqlerrd[2] = 1 sqlca.sqlerrd[2] = 36 sqlca.sqlerrd[2] = 10 sqlca.sqlerrd[2] = 0 sqlca.sqlerrd[2] = 2 sqlca.sqlerrd[2] = 35 This is self-consistent and correct. Which version are you using on which machine? Or what are you doing that is different? To answer your question, No, there are no other ways of getting the information. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> >From: jxt@magna.com (Jay Tang) >Date: Wed, 5 Jul 1995 14:40:41 GMT >X-Informix-List-Id: <news.15179> > >This is a problem with Informix 6 ESQL/C programming. After a successful >insert/update/delete, I'd like to get the number of rows processed. I've >tried sqlca.sqlerrd[2] and "get diagnostic" statement in my program. But >both of them gave me zero which was wrong. > >Are there any other ways to get this information? #include <stdio.h> #include <sqlca.h> void sqlerror(void) { fflush(stdout); fprintf(stderr, "SQL: %d; ISAM %d\\n", sqlca.sqlcode, sqlca.sqlerrd[1]); exit(1); } int main(int argc, char **argv) { EXEC SQL WHENEVER ERROR CALL sqlerror; EXEC SQL DATABASE stores; EXEC SQL CREATE TEMP TABLE junk (col01 INTEGER); EXEC SQL INSERT INTO Junk(Col01) VALUES(1); printf("sqlca.sqlerrd[2] = %d\\n", sqlca.sqlerrd[2]); EXEC SQL INSERT INTO Junk(Col01) SELECT Tabid FROM Systables; printf("sqlca.sqlerrd[2] = %d\\n", sqlca.sqlerrd[2]); EXEC SQL UPDATE Junk SET Col01 = Col01 + 100 WHERE Col01 > 100; printf("sqlca.sqlerrd[2] = %d\\n", sqlca.sqlerrd[2]); EXEC SQL UPDATE Junk SET Col01 = 1 WHERE Col01 = 101; printf("sqlca.sqlerrd[2] = %d\\n", sqlca.sqlerrd[2]); EXEC SQL DELETE FROM Junk WHERE Col01 = 1; printf("sqlca.sqlerrd[2] = %d\\n", sqlca.sqlerrd[2]); EXEC SQL DELETE FROM Junk; printf("sqlca.sqlerrd[2] = %d\\n", sqlca.sqlerrd[2]); return 0; }