This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-14. For the latest, interactive version please visit https://mariadb.com/kb/.

mysql_reset_connection

Syntax

int mysql_reset_connection(MYSQL * mysql);

Description

Resets the current connection and clears session state. Similar to mysql_change_user() or mariadb_reconnect(), mysql_reset_connection() resets session status, but without disconnecting, opening, or reauthenticating.

On client side mysql_reset_connection()

  • clears pending or unprocessed result sets
  • clears status like affected_rows, info or last_insert_id
  • invalidates active prepared statements

On server side mysql_reset_connection()

  • drops temporary table(s)
  • rollbacks active transaction
  • resets autocommit mode
  • releases table locks
  • initializes session variables (and sets them to the value of corresponding global variables)
  • closes active prepared statements
  • clears user variables

Returns zero on success, non zero if an error occurred.

This function was added in MariaDB Connector/C 3.0.0.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.