Returns ids of documents inserted or replaced by last statement in the current session.
The same value can be also received via @@session.last_insert_id
variable:
> select @@session.last_insert_id;
mysql+--------------------------+
| @@session.last_insert_id |+--------------------------+
11,32 |
| +--------------------------+
1 rows in set
> select LAST_INSERT_ID();
mysql+------------------+
| LAST_INSERT_ID() |+------------------+
25,26,29 |
| +------------------+
1 rows in set
SELECT @@system_variable [LIMIT [offset,] row_count]
This is currently a placeholder query that does nothing and reports success. That is in order to keep compatibility with frameworks and connectors that automatically execute this statement.
However @@session.last_insert_id
and LAST_INSERT_ID()
report ID
of documents these were inserted or replaced well at last statement.
> select @@session.last_insert_id;
mysql+--------------------------+
| @@session.last_insert_id |+--------------------------+
11,32 |
| +--------------------------+
1 rows in set
> select LAST_INSERT_ID();
mysql+------------------+
| LAST_INSERT_ID() |+------------------+
25,26,29 |
| +------------------+
1 rows in set
Returns current connection id.
> select CONNECTION_ID();
mysql+-----------------+
| CONNECTION_ID() |+-----------------+
6 |
| +-----------------+
1 row in set (0.00 sec)