Documentation Home
MySQL 8.0 C API Developer Guide
Download this Manual
PDF (US Ltr) - 1.2Mb
PDF (A4) - 1.2Mb
HTML Download (TGZ) - 158.8Kb
HTML Download (Zip) - 190.0Kb


MySQL 8.0 C API Developer Guide  /  C API Function Descriptions  /  mysql_reset_connection()

7.62 mysql_reset_connection()

int
mysql_reset_connection(MYSQL *mysql)

Description

Resets the connection to clear the session state.

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. The write set session history is reset. See Section 7.4, “mysql_change_user()”, and Chapter 28, C API Automatic Reconnection Control.

mysql_reset_connection() affects the connection-related state as follows:

  • Rolls back any active transactions and resets autocommit mode.

  • Releases all table locks.

  • Closes (and drops) all TEMPORARY tables.

  • Reinitializes session system variables to the values of the corresponding global system variables, including system variables that are set implicitly by statements such as SET NAMES.

  • Loses user-defined variable settings.

  • Releases prepared statements.

  • Closes HANDLER variables.

  • Resets the value of LAST_INSERT_ID() to 0.

  • Releases locks acquired with GET_LOCK().

  • Clears any current query attributes defined as a result of calling mysql_bind_param().

Return Values

Zero for success. Nonzero if an error occurred.