C API

Below is a list of C API functions. Click on a function in the list to see more information about it, including its syntax, an explanation of its use, and examples of how it may be used to interface with MySQL.
mysql_autocommit( )
Use this C API function to turn on or off auto-commit mode for the MySQL connection.
mysql_library_end( )
Use this C API function to close the MySQL library after disconnecting from the server.
mysql_change_user( )
Use this C API function to change the current user for the MySQL session to the one given as the second argument.
mysql_library_init( )
Use this C API function to initialize the MySQL library and any related libraries and systems before making any other MySQL function calls.
mysql_character_set_name( )
This C API function returns the name of the default character set in use by the MySQL server.
mysql_list_dbs( )
This C API function returns a results set containing a list of databases found for the current connection to MySQL.
mysql_close( )
Use this C API function to close the connection to the MySQL server.
mysql_list_fields( )
This C API function returns a results set containing a list of fields found for the MySQL table given.
mysql_commit( )
Use this C API function to commit the current transaction of MySQL.
mysql_list_processes( )
This C API function returns a results set containing a list of MySQL server processes or server threads found for the handle given as the argument to the function.
mysql_connect( )
This C API function is deprecated in favor of mysql_real_connect( ) for connecting to MySQL.
mysql_list_tables( )
This C API function returns a results set containing a list of MySQL tables in the currently selected MySQL database.
mysql_create_db( )
This C API function can be used to create a new database on the MySQL server, with the new database name is given as the second argument.
mysql_more_results( )
Use this C API function to determine whether more results remain in a results set from MySQL when using the mysql_next_result() function to retrieve data.
mysql_data_seek( )
Use this C API function in conjunction with mysql_store_result( ) and a fetch function to change the current row being fetched from MySQL.
mysql_next_result( )
Use this C API function to read the next row of data from a results set from MySQL.
mysql_debug( )
Use this C API function to set debugging if the client for MySQL was compiled with debugging.
mysql_num_fields( )
This C API function returns the number of fields in each row of a results set from MySQL.
mysql_drop_db( )
This C API function may be used to delete the database named in the second argument of the function from the MySQL server.
mysql_num_rows( )
This C API function returns the number of rows in the results set from MySQL when issued after the mysql_store_result() function.
mysql_dump_debug_info( )
Use this C API function to write debugging information about the current connection to the MySQL server's logfile.
mysql_ping( )
Use this C API function to determine whether the current MYSQL connection is still open.
mysql_eof( )
Use this C API function to determine whether the last row of the results set has been fetched from MySQL.
mysql_query( )
Use this C API function to execute the MySQL query given.
mysql_errno( )
This C API function returns the MySQL error number for the last function which was run if it failed to execute.
mysql_real_connect( )
Use this C API function to establish a connection to a MySQL server.
mysql_error( )
This C API function returns the MySQL error message for the last function which was run if it failed to execute.
mysql_real_escape_string( )
This C API function writes a string or MySQL column given to a string named, but with special characters escaped by adding backslashes in front of them.
mysql_escape_string( )
This C API function will return a string or MySQL column given with special characters escaped by adding backslashes in front of them.
mysql_real_query( )
Use this C API function to execute a MySQL query given.
mysql_fetch_field( )
This C API function returns a MYSQL_FIELD structure that provides information on a given field of a results set.
mysql_refresh( )
Use this C API function to flush caches and tables in MySQL.
mysql_fetch_fields( )
This C API function returns an array of information about the fields in a MySQL results set.
mysql_reload( )
This C API function instructs the MySQL server to reload the grants table.
mysql_fetch_field_direct( )
This C API function returns a MYSQL_FIELD structure that provides information on a given field of a results set referred to in the first argument of the function.
mysql_rollback( )
Use this C API function to roll back or reverse the current transaction in MySQL.
mysql_fetch_lengths( )
This C API function returns the length of each column within a particular row of a results set from MySQL.
mysql_row_seek( )
Use this C API function to move the pointer of a MySQL result set to the row given.
mysql_fetch_row( )
Use this C API function to retrieve the next row of a results set from MySQL.
mysql_row_tell( )
This C API function returns the pointer for the current position in a results set from MySQL, generated from the mysql_store_result( ) function.
mysql_field_count( )
This C API function returns the number of columns in a results set from MySQL.
mysql_select_db( )
Use this C API function to select a different MySQL database for the current connection to MySQL.
mysql_field_seek( )
Use this C API function in conjunction with mysql_fetch_field( ) to change the current field being fetched to the one specified in the second argument of this function.
mysql_set_character_set( )
Use this C API function to set the default character set of a MySQL connection to the character set given.
mysql_field_tell( )
This C API function returns the value of the field pointer for the current row in use by a fetch function such as mysql_fetch_field( ).
mysql_set_local_infile_default( )
Use this C API function to set the handler for LOAD LOCAL DATA INFILE functions to the defaults necessary for internal use of the C client library when interacting with MySQL.
mysql_free_result( )
Use this C API function to free memory allocated under particular conditions related to MySQL.
mysql_set_local_infile_handler( )
Use this C API function to enable callbacks that will be used with the LOAD DATA LOCAL INFILE statement in MySQL.
mysql_get_character_set_info( )
This C API function returns the default character set information for the MySQL database given.
mysql_set_server_option( )
Use this C API function to enable or disable a MySQL server option.
mysql_get_client_info( )
This C API function returns the MySQL client library version.
mysql_shutdown( )
Use this C API function to shut down the MySQL server.
mysql_get_client_version( )
This C API function returns the MySQL client library version in a numeric format.
mysql_sqlstate( )
This C API function returns the SQLSTATE error code for the last error in MySQL that occurred for the current connection to MySQL.
mysql_get_host_info( )
This C API function returns the hostname and the connection type for the current connection to MySQL.
mysql_ssl_set( )
This C API function is used to make a secure connection to MySQL with SSL.
mysql_get_proto_info( )
This C API function returns the protocol version for the current connection to MySQL.
mysql_stat( )
This C API function returns a character string containing information about the status of the MySQL server for the current connection.
mysql_get_server_info( )
This C API function returns a string containing the version of MySQL running on the server for the current connection.
mysql_store_result( )
Use this C API function to read and store all of a results set from MySQL in a MYSQL_RES structure.
mysql_get_server_version( )
This C API function returns the version of the MySQL server for the current connection in a numeric format.
mysql_thread_end( )
Use this C API function before calling to free memory used by mysql_thread_init( ) related to MySQL.
mysql_get_ssl_cipher( )
This C API function returns a string with the name of the SSL cipher which was used for the MySQL connection given.
mysql_thread_id( )
This C API function returns the thread identifier number for the current connection to MySQL.
mysql_hex_string( )
This C API function can be used to translate a hexadecimal string to a format that can be used in a MySQL statement.
mysql_thread_init( )
Use this C API function to initialize thread specific variables in MySQL.
mysql_info( )
This C API function returns a string containing information provided by MySQL when certain SQL statements are executed.
mysql_thread_safe( )
Use this C API function to determine whether the MySQL client library is safe for a threaded environment.
mysql_init( )
This C API function optionally allocates, and then initializes, a MYSQL object suitable for connecting to a MySQL server and subsequently performing many of the other operations.
mysql_use_result( )
Use this C API function to read the results of a MySQL query, one row at a time.
mysql_insert_id( )
This C API function returns the identification number issued to the primary key of the last record inserted using INSERT in MySQL for the current connection.
mysql_warning_count( )
This C API function returns the number of MySQL warning messages encountered from the previous query.
mysql_kill( )
Use this C API function to terminate a thread on the MySQL server.