session_unique_id
NAME
session_unique_id(): Return a unique unsigned integer for this sessionTYPE
FunctionDESCRIPTION
This function returns unique values per session. That is, any two calls to this function from within the same session, result with different, unique values.
The function utilizes the fact that a session is managed serially (it it generally unsafe and undesired to issue concurrent queries on same connection). Therefore, it is known that any two calls on this function are essentially serialized within the session
Current implementation of this function is to return incrementing unsigned integer values. However, the user should not rely on this behavior, and should not assume consecutive results on consecutive calls.
SYNOPSIS
session_unique_id() RETURNS INT UNSIGNED
Output:
- A unique value within current session.
EXAMPLES
Get unique values:
mysql> SELECT session_unique_id(), session_unique_id(); +---------------------+---------------------+ | session_unique_id() | session_unique_id() | +---------------------+---------------------+ | 1 | 2 | +---------------------+---------------------+ 1 row in set (0.02 sec) mysql> SELECT session_unique_id(); +---------------------+ | session_unique_id() | +---------------------+ | 3 | +---------------------+ENVIRONMENT
MySQL 5.1 or newerAUTHOR
Shlomi Noach