List:General Discussion« Previous MessageNext Message »
From:Matthias Pigulla Date:June 2 1999 10:13pm
Subject:Re: mysql_insert_id()
View as plain text  
Jim Faucette wrote:
> The manual is vague on this point.
> "It will not even be changed if you update another `AUTO_INCREMENT'
> column with a non-magic value (that is, a value that is not `NULL' and
> not 0)."
> Unfortunately the manual is mute on what should happen to LAST_INSERT_ID
> after an INSERT into a NON-AUTO_INCREMENT field. If you want to use the

"Returns the ID that was most recently generated for an AUTO_INCREMENT
field." (18.4.27.1) implies that tables without such fields don't change
the value.

> original value to update or insert into more than one table, you
> probably should retain it yourself rather than rely on MySQL.

I'm using (my)SQL LAST_INSERT_ID() for this right now. I'm in need of
mysql_insert_id for logging purposes when my application shuts down, and
thus I want it from the MYSQL struct, and not pass it around all over
the application all the time just to have it at hand later on.

Matthias
-- 
   w e b f a c t o r y | matthias pigulla
      www.webfactory.de  mp@stripped
Thread
mysql_insert_id()Matthias Pigulla1 Jun
  • Re: mysql_insert_id()Paul DuBois1 Jun
    • Re: mysql_insert_id()Matthias Pigulla3 Jun
      • Re: mysql_insert_id()Paul DuBois3 Jun
    • Re: mysql_insert_id()Jim Faucette3 Jun
    • Re: mysql_insert_id()Matthias Pigulla3 Jun
      • Re: mysql_insert_id()Benjamin Pflugmann3 Jun
        • Re: mysql_insert_id()Michael Widenius3 Jun
          • Re: mysql_insert_id()Paul DuBois3 Jun
    • Re: mysql_insert_id()Matthias Pigulla3 Jun
    • Re: mysql_insert_id()Matthias Pigulla3 Jun
      • Re: mysql_insert_id()Michael Widenius3 Jun