mysql_reset_connection() - mysql/mysql.h
Resets the connection to clear the session state. This function
was added in MySQL 5.7.3.mysql_reset_connection() has
effects similar to
mysql_change_user() or an
auto-reconnect except that the connection is not closed and
reopened, and reauthentication is not done. See
Section 25.8.7.3, “mysql_change_user()”) and see
Section 25.8.16, “Controlling Automatic Reconnection Behavior”).mysql_reset_connection()mysql_reset_connection()mysql_change_user()mysql_change_user()Section 25.8.7.3, “mysql_change_user()”Section 25.8.16, “Controlling Automatic Reconnection Behavior”The connection-related state is affected as follows:Any active transactions are rolled back and autocommit mode
is reset.
All table locks are released.
All TEMPORARY tables are closed (and
dropped).
Session system variables are reinitialized to the values of
the corresponding global system variables, including system
variables that are set implicitly by statements such as
SET NAMES.
User variable settings are lost.
Prepared statements are released.
HANDLER variables are closed.
The value of LAST_INSERT_ID()
is reset to 0.
Locks acquired with
GET_LOCK() are released.Any active transactions are rolled back and autocommit mode
is reset.
All table locks are released.
All TEMPORARY tables are closed (and
dropped).
Session system variables are reinitialized to the values of
the corresponding global system variables, including system
variables that are set implicitly by statements such as
SET NAMES.
User variable settings are lost.
Prepared statements are released.
HANDLER variables are closed.
The value of LAST_INSERT_ID()
is reset to 0.
Locks acquired with
GET_LOCK() are released.Any active transactions are rolled back and autocommit mode
is reset.Any active transactions are rolled back and autocommit mode
is reset.All table locks are released.All table locks are released.All TEMPORARY tables are closed (and
dropped).All TEMPORARY tables are closed (and
dropped).TEMPORARYSession system variables are reinitialized to the values of
the corresponding global system variables, including system
variables that are set implicitly by statements such as
SET NAMES.Session system variables are reinitialized to the values of
the corresponding global system variables, including system
variables that are set implicitly by statements such as
SET NAMES.SET NAMESSET NAMESUser variable settings are lost.User variable settings are lost.Prepared statements are released.Prepared statements are released.HANDLER variables are closed.HANDLER variables are closed.HANDLERHANDLERThe value of LAST_INSERT_ID()
is reset to 0.The value of LAST_INSERT_ID()
is reset to 0.LAST_INSERT_ID()LAST_INSERT_ID()Locks acquired with
GET_LOCK() are released.Locks acquired with
GET_LOCK() are released.GET_LOCK()GET_LOCK()
Syntax
int mysql_reset_connection(MYSQL *mysql)
Example
Output / Return Value
Zero for success. Nonzero if an error occurred.
Limitations
Alternatives / See Also
Reference