Re: Accessing last_insert_id problem.

2003-01-02 Thread Matthew Smith
LAST_INSERT_ID is held for the database connection, not agaist the server So, as long as you do not do another insert using the same database connection, LAST_INSERT_ID will be fine. (for database connection, $dbh=DBI->connect. ) No table locking required. Regards M On Wed, 18 Dec 2002

RE: Accessing last_insert_id problem.

2002-12-20 Thread Will Merrell
Jeff Snoxell wrote: > At 09:46 19/12/02 -0500, you wrote: > >Jeff Snoxell wrote: > > > >>Nope. That doesn't do it either! > >> > >>I go: > >> > >>TRUNCATE TABLE my_table > > > >Are you using InnoDB tables? You'll have to do something akin to ALTER > >TABLE my_table AUTO_INCREMENT=1 ... at least ac

Re: Accessing last_insert_id problem.

2002-12-19 Thread Paul DuBois
At 15:13 + 12/19/02, Jeff Snoxell wrote: At 09:46 19/12/02 -0500, you wrote: Jeff Snoxell wrote: Nope. That doesn't do it either! I go: TRUNCATE TABLE my_table Are you using InnoDB tables? You'll have to do something akin to ALTER TABLE my_table AUTO_INCREMENT=1 ... at least accordin

Re: Accessing last_insert_id problem.

2002-12-19 Thread Jeff Snoxell
At 09:46 19/12/02 -0500, you wrote: Jeff Snoxell wrote: Nope. That doesn't do it either! I go: TRUNCATE TABLE my_table Are you using InnoDB tables? You'll have to do something akin to ALTER TABLE my_table AUTO_INCREMENT=1 ... at least according to Paul ... :) No, I'm using MyISAM I belie

re: Accessing last_insert_id problem.

2002-12-19 Thread Wico de Leeuw
http://www.mysql.com/doc/en/SET_OPTION.html last option(s) maybe you can do somehting with that Gr At 10:54 19-12-02 +, Jeff Snoxell wrote: I'm working with MySQL 3.23.36 so, according to "MySQL, Paul Dubois, New Riders" running the query: "DELETE FROM my_table_name" should reset the a

re: Accessing last_insert_id problem.

2002-12-19 Thread Jeff Snoxell
I'm working with MySQL 3.23.36 so, according to "MySQL, Paul Dubois, New Riders" running the query: "DELETE FROM my_table_name" should reset the auto-increment value... but it doesnt'. What SQL do I use to reset the val. You can't believe anything that book says. The author didn't even incl

re: Accessing last_insert_id problem.

2002-12-18 Thread Paul DuBois
At 15:31 + 12/18/02, Jeff Snoxell wrote: Hi, I've got that sussed now and am happily using the aquired ref to subsequently play with the record etc. One other related problem and I recon I'm sorted How do I reset the auto-increment value? I'm working with MySQL 3.23.36 so, according t

Re: Accessing last_insert_id problem.

2002-12-18 Thread Paul DuBois
At 12:21 + 12/18/02, Jeff Snoxell wrote: Hi, I'm adding records to a db using the Perl DBI. Subsequent to adding a record I need to know the value of the auto-incrementing 'Ref' field so that I can place a copy of the relavent details into a log file. I could query for the "LAST_INSERT_ID

Re: Accessing last_insert_id problem.

2002-12-18 Thread Michael T. Babcock
Jeff Snoxell wrote: "DELETE FROM my_table_name" should reset it... but it doesnt'. I'm glad the DELETE FROM doesn't, or else my foreign keys would all get screwed up :) TRUNCATE should do what you want (as someone else pointed out). -- Michael T. Babcock C.T.O., FibreSpeed Ltd. ... SQL ht

re: Accessing last_insert_id problem.

2002-12-18 Thread Wico de Leeuw
At 15:31 18-12-02 +, Jeff Snoxell wrote: Hi, I've got that sussed now and am happily using the aquired ref to subsequently play with the record etc. One other related problem and I recon I'm sorted How do I reset the auto-increment value? I'm working with MySQL 3.23.36 so, according t

re: Accessing last_insert_id problem.

2002-12-18 Thread Jeff Snoxell
Hi, I've got that sussed now and am happily using the aquired ref to subsequently play with the record etc. One other related problem and I recon I'm sorted How do I reset the auto-increment value? I'm working with MySQL 3.23.36 so, according to "MySQL, Paul Dubois, New Riders" running th

re: Accessing last_insert_id problem.

2002-12-18 Thread Victoria Reznichenko
On Wednesday 18 December 2002 14:21, Jeff Snoxell wrote: > I'm adding records to a db using the Perl DBI. Subsequent to adding a > record I need to know the value of the auto-incrementing 'Ref' field so > that I can place a copy of the relavent details into a log file. > > I could query for the "L