Re: Serial database
Posted in 1997
Art S. Kagel wrote: > Assuming your tool is ESQL-C or 4GL the serial number just added is > returned in the sqlca structure immediately after the INSERT/PUT/FLUSH > statement that actually INSERTED the row (PUT to an INSERT CURSOR may > not actually add the row but writes to a buffer the FLUSH actually > writes the row to the database). This is sqlca.sqlerrd[1] in ESQL-C > or sqlca.sqlerrd[2] in 4GL. After a FLUSH the serial number for the > last row added is reported so if you need each serial and use an > INSERT CURSOR you must FLUSH after each PUT. > > For other tools, I posted a stored procedure solution to this problem > last week for someone using ODBC of JDBC or some such. > > Art S. Kagel Just a side note. The serial field, one per table, is not stored in the *table*. What I am talking about is the field which is a long, Informix (INTEGER). When you insert or attempt to perform the insert, the serial field is incremented immeadiately. So, if you roll back the transaction, the serial value is still incremented. I did some test on this using standard engine about a year ago and posted the results here. Since the serial field is not in the table per se, TTBOMK, you cannot view this data while online is live. (That is why I used SE to test with. ;-) This actually brings a question to mind, so perhaps someone from informix can reply: 1) Is there a method of viewing the serial value while the engine is alive. 2) There must be a semaphore lock when using a serial field. How much of an additional cost exists when using a serial column? -Mikey -- #include <std_disclaimer.h> /* Mike Segel (MS385) */ #include <No_Spam.h> #ifdef OFFENDED_BY_CONTENT The author takes no responsibility for this post. Any resemblence to a coherent rational thought is purely coincidence. -The Management. #endif ***************************** Due to AGIS's Refusal to Act Responsibly We are blocking all of their domains at the packet level. This block will exist until AGIS modifies their policies to conform to existing RFCs and net community standards. We encourage all ISPs and domain holders to do the same. *****************************