Commit 419b672a authored by unknown's avatar unknown

First drop merge table, then other tables


Docs/manual.texi:
  Updated information about mysql_insert_id()
parent dacdb5b9
...@@ -31863,9 +31863,10 @@ The reason for this is so that you it makes it possible to easily reproduce ...@@ -31863,9 +31863,10 @@ The reason for this is so that you it makes it possible to easily reproduce
the same @code{INSERT} statement against some other server. the same @code{INSERT} statement against some other server.
@cindex sequence emulation @cindex sequence emulation
If @code{expr} is given as an argument to @code{LAST_INSERT_ID()} in an If @code{expr} is given as an argument to @code{LAST_INSERT_ID()}, then
@code{UPDATE} clause, then the value of the argument is returned as a the value of the argument is returned by the function, is set as the
@code{LAST_INSERT_ID()} value. This can be used to simulate sequences. next value to be returned by @code{LAST_INSERT_ID()} and used as the next
auto_increment value. This can be used to simulate sequences:
First create the table: First create the table:
...@@ -31888,6 +31889,12 @@ MySQL. For example, @code{LAST_INSERT_ID()} (without an argument) ...@@ -31888,6 +31889,12 @@ MySQL. For example, @code{LAST_INSERT_ID()} (without an argument)
will return the new ID. The C API function @code{mysql_insert_id()} will return the new ID. The C API function @code{mysql_insert_id()}
can also be used to get the value. can also be used to get the value.
Note that as @code{mysql_insert_id()} is only updated after
@code{INSERT} and @code{UPDATE} statements, you can't use this function
to retrieve the value used @code{LAST_INSERT_ID(expr)} for other SQL
statements.
@findex FORMAT() @findex FORMAT()
@item FORMAT(X,D) @item FORMAT(X,D)
Formats the number @code{X} to a format like @code{'#,###,###.##'}, rounded Formats the number @code{X} to a format like @code{'#,###,###.##'}, rounded
...@@ -40633,6 +40640,10 @@ does not generate an @code{AUTO_INCREMENT} value. If you need to save ...@@ -40633,6 +40640,10 @@ does not generate an @code{AUTO_INCREMENT} value. If you need to save
the value for later, be sure to call @code{mysql_insert_id()} immediately the value for later, be sure to call @code{mysql_insert_id()} immediately
after the query that generates the value. after the query that generates the value.
@code{mysql_insert_id()} is only updated after @code{INSERT} and
@code{UPDATE} statements, not after using @code{LAST_INSERT_ID(expr)}.
@xref{Miscellaneous functions}.
Also note that the value of the SQL @code{LAST_INSERT_ID()} function always Also note that the value of the SQL @code{LAST_INSERT_ID()} function always
contains the most recently generated @code{AUTO_INCREMENT} value, and is contains the most recently generated @code{AUTO_INCREMENT} value, and is
not reset between queries because the value of that function is maintained not reset between queries because the value of that function is maintained
...@@ -113,4 +113,4 @@ insert into t1 values (1,2),(2,1),(0,0),(4,4),(5,5),(6,6); ...@@ -113,4 +113,4 @@ insert into t1 values (1,2),(2,1),(0,0),(4,4),(5,5),(6,6);
insert into t2 values (1,1),(2,2),(0,0),(4,4),(5,5),(6,6); insert into t2 values (1,1),(2,2),(0,0),(4,4),(5,5),(6,6);
flush tables; flush tables;
select * from t3 where a=1 order by b limit 2; select * from t3 where a=1 order by b limit 2;
drop table t1,t2,t3; drop table t3,t1,t2;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment