summaryrefslogtreecommitdiff
path: root/Docs/manual.texi
diff options
context:
space:
mode:
authorunknown <monty@tik.mysql.fi>2001-09-12 00:11:18 +0300
committerunknown <monty@tik.mysql.fi>2001-09-12 00:11:18 +0300
commita53e8ea0ac4f7d53297b7942febf04e02d8c3b54 (patch)
tree232e45a7f1b949aa887095fad827cbbb1363c92a /Docs/manual.texi
parenta278411271b00f0f1c8b49eb659dbeffa4cfce10 (diff)
downloadmariadb-git-a53e8ea0ac4f7d53297b7942febf04e02d8c3b54.tar.gz
First drop merge table, then other tables
Docs/manual.texi: Updated information about mysql_insert_id()
Diffstat (limited to 'Docs/manual.texi')
-rw-r--r--Docs/manual.texi17
1 files changed, 14 insertions, 3 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