MySQL 8.0 C API Developer Guide  /  C API Function Reference

Chapter 4 C API Function Reference

The following table summarizes all functions available for the MySQL C API. For greater detail, see the individual function descriptions.

Table 4.1 C API Functions

Name Description Introduced Deprecated
mysql_affected_rows() Number of rows changed/deleted/inserted by last UPDATE, DELETE, or INSERT statement
mysql_autocommit() Set autocommit mode
mysql_bind_param() Define query attributes for next statement executed 8.0.23
mysql_binlog_close() Close replication event stream
mysql_binlog_fetch() Read event from replication event stream
mysql_binlog_open() Open replication event stream
mysql_change_user() Change user and database on an open connection
mysql_character_set_name() Default character set name for current connection
mysql_client_find_plugin() Return pointer to a plugin
mysql_client_register_plugin() Register a plugin
mysql_close() Close connection to server
mysql_commit() Commit transaction
mysql_connect() Connect to MySQL server Yes
mysql_create_db() Create database Yes
mysql_data_seek() Seek to arbitrary row number in query result set
mysql_debug() Perform DBUG_PUSH with given string
mysql_drop_db() Drop database Yes
mysql_dump_debug_info() Cause server to write debug information to error log
mysql_eof() Determine whether last row of result set has been read Yes
mysql_errno() Error number for most recently invoked MySQL function
mysql_error() Error message for most recently invoked MySQL function
mysql_escape_string() Escape special characters in string for use in SQL statement
mysql_fetch_field() Type of the next table field
mysql_fetch_field_direct() Table field type for given field number
mysql_fetch_fields() Return array of all field structures
mysql_fetch_lengths() Return lengths of all columns in current row
mysql_fetch_row() Fetch next result set row
mysql_fetch_row_nonblocking() Asynchronously fetch next result set row 8.0.16
mysql_field_count() Number of result columns for most recent statement
mysql_field_seek() Seek to column within result set row
mysql_field_tell() Field position for last mysql_fetch_field() call
mysql_free_result() Free result set memory
mysql_free_result_nonblocking() Asynchronously free result set memory 8.0.16
mysql_get_character_set_info() Information about default character set
mysql_get_client_info() Client version (string)
mysql_get_client_version() Client version (integer)
mysql_get_host_info() Information about the connection
mysql_get_option() Value of a mysql_options() option
mysql_get_proto_info() Protocol version used by the connection
mysql_get_server_info() Server version number (string)
mysql_get_server_version() Server version number (integer)
mysql_get_ssl_cipher() Current SSL cipher
mysql_hex_string() Encode string in hexadecimal format
mysql_info() Information about most recently executed statement
mysql_init() Get or initialize a MYSQL structure
mysql_insert_id() ID generated for an AUTO_INCREMENT column by previous statement
mysql_kill() Kill a thread Yes
mysql_library_end() Finalize MySQL C API library
mysql_library_init() Initialize MySQL C API library
mysql_list_dbs() Return database names matching regular expression
mysql_list_fields() Return field names matching regular expression
mysql_list_processes() List of current server threads
mysql_list_tables() Return table names matching regular expression
mysql_load_plugin() Load a plugin
mysql_load_plugin_v() Load a plugin
mysql_more_results() Check whether more results exist
mysql_next_result() Return/initiate next result in multiple-result execution
mysql_next_result_nonblocking() Asynchronously return/initiate next result in multiple-result execution 8.0.16
mysql_num_fields() Number of columns in result set
mysql_num_rows() Number of rows in result set
mysql_options() Set option prior to connecting
mysql_options4() Set option prior to connecting
mysql_ping() Ping server
mysql_plugin_get_option() Get plugin option 8.0.27
mysql_plugin_options() Set plugin option
mysql_query() Execute statement
mysql_real_connect() Connect to MySQL server
mysql_real_connect_dns_srv() Connect to MySQL server using DNS SRV record 8.0.22
mysql_real_connect_nonblocking() Asynchronously connect to MySQL server 8.0.16
mysql_real_escape_string() Encode special characters in statement string
mysql_real_escape_string_quote() Encode special characters in statement string accounting for quoting context
mysql_real_query() Execute statement
mysql_real_query_nonblocking() Asynchronously execute statement 8.0.16
mysql_refresh() Flush or reset tables and caches
mysql_reload() Reload grant tables Yes
mysql_reset_connection() Reset the connection to clear session state
mysql_reset_server_public_key() Clear cached RSA public key from client library
mysql_result_metadata() Whether a result set has metadata 8.0.13
mysql_rollback() Roll back transaction
mysql_row_seek() Seek to row offset in result set
mysql_row_tell() Current position within result set row
mysql_select_db() Select database
mysql_server_end() Finalize MySQL C API library
mysql_server_init() Initialize MySQL C API library
mysql_session_track_get_first() First part of session state-change information
mysql_session_track_get_next() Next part of session state-change information
mysql_set_character_set() Set current connection default character set
mysql_set_local_infile_default() Set LOAD DATA LOCAL handler callbacks to default values
mysql_set_local_infile_handler() Install application-specific LOAD DATA LOCAL handler callbacks
mysql_set_server_option() Set option for current connection
mysql_shutdown() Shut down MySQL server
mysql_sqlstate() SQLSTATE value for most recently invoked MySQL function
mysql_ssl_set() Prepare to establish SSL connection to server
mysql_stat() Server status
mysql_stmt_affected_rows() Number of rows changed/deleted/inserted by last prepared UPDATE, DELETE, or INSERT statement
mysql_stmt_attr_get() Get attribute value for prepared statement
mysql_stmt_attr_set() Set attribute value for prepared statement
mysql_stmt_bind_param() Associate application data buffers with parameter markers in prepared statement
mysql_stmt_bind_result() Associate application data buffers with columns in result set
mysql_stmt_close() Free memory used by prepared statement
mysql_stmt_data_seek() Seek to arbitrary row number in prepared statement result set
mysql_stmt_errno() Error number for most recently invoked MySQL prepared-statement function
mysql_stmt_error() Error message for most recently invoked MySQL prepared-statement function
mysql_stmt_execute() Execute prepared statement
mysql_stmt_fetch() Fetch next result set row and return data for all bound columns
mysql_stmt_fetch_column() Fetches data for one column of current result set row
mysql_stmt_field_count() Number of result columns for most recent prepared statement
mysql_stmt_free_result() Free resources allocated to statement handler
mysql_stmt_init() Allocate and initialize memory for MYSQL_STMT structure
mysql_stmt_insert_id() ID generated for an AUTO_INCREMENT column by previous prepared statement
mysql_stmt_next_result() Return/initiate next result in multiple-result prepared statement execution
mysql_stmt_num_rows() Row count from buffered statement result set
mysql_stmt_param_count() Number of parameters in prepared statement
mysql_stmt_param_metadata() Return parameter metadata as result set
mysql_stmt_prepare() Prepare statement for execution
mysql_stmt_reset() Reset statement buffers on server side
mysql_stmt_result_metadata() Return prepared statement metadata as result set
mysql_stmt_row_seek() Seek to row offset in prepared statement result set
mysql_stmt_row_tell() Current position within prepared statement result set row
mysql_stmt_send_long_data() Send long data in chunks to server
mysql_stmt_sqlstate() SQLSTATE value for most recently invoked MySQL prepared-statement function
mysql_stmt_store_result() Retrieve and store entire result set
mysql_store_result() Retrieve and store entire result set
mysql_store_result_nonblocking() Asynchronously retrieve and store entire result set 8.0.16
mysql_thread_end() Finalize thread handler
mysql_thread_id() Current thread ID
mysql_thread_init() Initialize thread handler
mysql_thread_safe() Whether client is compiled thread-safe
mysql_use_result() Initiate row-by-row result set retrieval
mysql_warning_count() Warning count for previous statement