From: Phil D. <ph...@du...> - 2004-02-26 20:21:01
|
I use SuSE 8.2 I see what you mean about select max when the transaction has incremented the autonumber column.It would be nicer to retrieve this ID from the detail table after the insert. However, I just did a search and discovered. ... pg_last_oid (PHP 4 >= 4.2.0) pg_last_oid -- Returns the last object's oid Description int pg_last_oid ( resource result) pg_last_oid() is used to retrieve the oid assigned to an inserted tuple (record) if the result resource is used from the last command sent via pg_query() and was an SQL INSERT. Returns a positive integer if there was a valid oid. It returns FALSE if an error occurs or the last command sent via pg_query() was not an INSERT or INSERT is failed. OID field became an optional field from PostgreSQL 7.2. When OID field is not defined in a table, programmer must use pg_result_status() to check if record is is inserted successfully or not. Note: This function used to be called pg_getlastoid(). See also pg_query() and pg_result_status() > > > Yes, standard transacting is supported, however it using "select max" is > still a clutch for now, I will replace it with looking up the current > generator/autonumber value which is guaranteed to be correct in a > transaction on a per connection basis. The changes to > DB_LastInsertID is already done, and MySQL still runs without a hitch. > > I am busy finalizing the converter to calculate the generator/autonumber > for setting it at the end of the script. So far everything imports. > > I would like to test it in the sql with the foreign keys included. > I use > mysqldump -u root -c -Q weberp18 >./weberp.sql > > Danie > |