I'm not going to address these comments to anyone - in an attempt to avoid
inter-personal conflict...
Herewith some psychology and philosophy:
- some people can't be bothered to read the manual
- writing a (good/complete) manual is even harder than reading it
- fully appreciating each fine
On Thu, 31 Jan 2002, DL Neil wrote:
...
What should be understood is that MySQL's implementation of AUTO_INCREMENT requires
a particular/different
philosophical view: that first the 'primary row' is to be stored, then the
AUTO_INCREMENT data captured, and
finally the dependent row is
William,
What should be understood is that MySQL's implementation of AUTO_INCREMENT
requires a particular/different
philosophical view: that first the 'primary row' is to be stored, then the
AUTO_INCREMENT data captured, and
finally the dependent row is stored (in the second table) - a
On Thu, 31 Jan 2002, DL Neil wrote:
Date: Thu, 31 Jan 2002 21:28:04 -
From: DL Neil [EMAIL PROTECTED]
To: William R. Mussatto [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: next insert id (slightly OT)
William,
What should be understood is that MySQL's implementation
database,sql,query,table
I need to find out what the next value will be in an auto_increment field
will be. could someone help me out with the select statement?
-
Before posting, please check:
SELECT MAX(id) FROM table;
will get you the highest value for 'id', that +1 will be the 'next' value,
until someone inserts a new row into that table.
james montebello
On Tue, 29 Jan 2002, Joel Wickard wrote:
database,sql,query,table
I need to find out what the next value will be in an
-Original Message-
From: Joel Wickard [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 29, 2002 7:04 PM
To: [EMAIL PROTECTED]
Subject: next insert id
database,sql,query,table
I need to find out what the next value will be in an auto_increment
field
will be. could someone help me out
At 17:03 -0800 1/29/02, Joel Wickard wrote:
database,sql,query,table
I need to find out what the next value will be in an auto_increment field
will be. could someone help me out with the select statement?
You can't find out what it *will be* until you actually create the record.
Then you get
Not _necessarily_ true, surely, if there's another transaction active at
the moment (assuming you are using a table that supports transactions)...?
At 03:16 PM 1/29/2002 -0800, James Montebello wrote:
SELECT MAX(id) FROM table;
will get you the highest value for 'id', that +1 will be the
At 15:16 -0800 1/29/02, James Montebello wrote:
SELECT MAX(id) FROM table;
will get you the highest value for 'id', that +1 will be the 'next' value,
until someone inserts a new row into that table.
Which may already have happened between the time you created your record
and the time you issue
assuming id is the auto incremnt field.
-
Johnny Withers
[EMAIL PROTECTED]
p. 601.853.0211
c. 601.209.4985
-Original Message-
From: Joel Wickard [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 29, 2002 7:04 PM
To: [EMAIL PROTECTED]
Subject: next insert id
This result will be invalid when the a new row is written to the table,
whether it's part of a transaction or not, no matter what the table type.
I said as much, but perhaps I was a bit too cryptic.
Generally speaking, getting this value reliably while other work is
going on is only possible if
Of course, if you do LAST_INSERT_ID, then try to use the value while someone
else is doing an insert, you're in the same boat. Neither method is reliable
without a lock.
james montebello
On Tue, 29 Jan 2002, Paul DuBois wrote:
At 15:16 -0800 1/29/02, James Montebello wrote:
SELECT MAX(id)
PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, January 29, 2002 4:16 PM
Subject: Re: next insert id
SELECT MAX(id) FROM table;
will get you the highest value for 'id', that +1 will be the 'next' value,
until someone inserts a new row into that table.
james montebello
On Tue, 29 Jan 2002, Joel
* James Montebello
Of course, if you do LAST_INSERT_ID, then try to use the value
while someone else is doing an insert, you're in the same boat.
Neither method is reliable without a lock.
This is not correct. The LAST_INSERT_ID() function return the last inserted
auto increment key for
At 15:35 -0800 1/29/02, James Montebello wrote:
Of course, if you do LAST_INSERT_ID, then try to use the value while someone
else is doing an insert, you're in the same boat. Neither method is reliable
without a lock.
That's incorrect. LAST_INSERT_ID() is client-specific,
other clients can't
Wickard [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 29, 2002 7:04 PM
To: [EMAIL PROTECTED]
Subject: next insert id
database,sql,query,table
I need to find out what the next value will be in an auto_increment
field
will be. could someone help me out with the select statement
At 15:33 -0800 1/29/02, James Montebello wrote:
This result will be invalid when the a new row is written to the table,
whether it's part of a transaction or not, no matter what the table type.
I said as much, but perhaps I was a bit too cryptic.
Generally speaking, getting this value reliably
The original question that started this thread was:
I need to find out what the next value will be in an auto_increment field
will be. could someone help me out with the select statement?
To which I replied:
You can't find out what it *will be* until you actually create the record.
Then you
Other people do know how to read manuals, Paul.
If the original poster made any assumptions about the NEXT value in the
auto increment field based on the value of LAST_INSERT_ID, that assumed
value will be invalid the second another row is written to the table.
If I did this:
INSERT INTO foo
At 17:38 -0800 1/29/02, James Montebello wrote:
Other people do know how to read manuals, Paul.
If the original poster made any assumptions about the NEXT value in the
auto increment field based on the value of LAST_INSERT_ID, that assumed
value will be invalid the second another row is written
21 matches
Mail list logo