diff options
author | monty@tik.mysql.fi <> | 2001-09-12 00:11:18 +0300 |
---|---|---|
committer | monty@tik.mysql.fi <> | 2001-09-12 00:11:18 +0300 |
commit | 46f944f4a43612ec75df32737625a95d01e751e8 (patch) | |
tree | 232e45a7f1b949aa887095fad827cbbb1363c92a | |
parent | b68923066be5d205813784e883046fb8a1e82238 (diff) | |
download | mariadb-git-46f944f4a43612ec75df32737625a95d01e751e8.tar.gz |
First drop merge table, then other tables
-rw-r--r-- | Docs/manual.texi | 17 | ||||
-rw-r--r-- | mysql-test/t/merge.test | 2 |
2 files changed, 15 insertions, 4 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index 834782257d1..c63fb14011e 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -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. @cindex sequence emulation -If @code{expr} is given as an argument to @code{LAST_INSERT_ID()} in an -@code{UPDATE} clause, then the value of the argument is returned as a -@code{LAST_INSERT_ID()} value. This can be used to simulate sequences. +If @code{expr} is given as an argument to @code{LAST_INSERT_ID()}, then +the value of the argument is returned by the function, is set as the +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: @@ -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()} 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() @item FORMAT(X,D) 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 the value for later, be sure to call @code{mysql_insert_id()} immediately 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 contains the most recently generated @code{AUTO_INCREMENT} value, and is not reset between queries because the value of that function is maintained diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 6820242d562..238dd599664 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -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); flush tables; select * from t3 where a=1 order by b limit 2; -drop table t1,t2,t3; +drop table t3,t1,t2; |