Re: Getting Serial Value
Posted in 1997
ontop wrote: > Tauren Mills wrote: > > > Am I missing something? Is there a way to return the value that the > > > SERIAL column gets set to? Or is there a way to at least return the > > > ROWID of the newly inserted column? I'm using an "INSERT INTO > > customers" statement to insert a new row will all null values except > > > the > > primary key. Can I get the info I need if I use an updatable > cursor? > > > > Yes, you are missing the fact that the sqlca structure contains a > field > sqlerrd[1] > which contains the generated value for a serial column. I include > sqlca.h in my > ESQL/C programs to be able to access this field. (Or in 4GL, it would be sqlca.sqlerrd[2] (Due to 4GL inability to recognize 0 as the logical starting point for any array offset)). Also, if you are using an insert cursor, forget about getting your serial value. This is due to the fact that insert cursors only actually insert into the database, when 1) they are closed, 2) they fill up their buffer and must be flushed, or 3) you explicitly flush them. -- - Danny Wright danwright@bigfoot.com #include <stddisclaimers.h> * God is real, unless declared as an integer. * Why do programmers get Halloween and Christmas mixed up? Because 0CT(31) == DEC(25) * I'd love to change the world, but I can't get into the source code. * /nev/dull