MySQL 9.1 C API Developer Guide

Abstract

This is the MySQL 9.1 C API Developer Guide. This document accompanies MySQL 9.1 Reference Manual.

The C API provides low-level access to the MySQL client/server protocol and enables C programs to access database contents. The C API code is distributed with MySQL and implemented in the libmysqlclient library.

For legal information, see the Legal Notices.

For help with using MySQL, please visit the MySQL Forums, where you can discuss your issues with other MySQL users.

Document generated on: 2024-11-19 (revision: 80261)

Table of Contents

Preface and Legal Notices
1 The MySQL C API
2 MySQL C API Implementations
3 Writing C API-Based Client Applications
3.1 Example C API Client Programs
3.2 Building C API Client Programs
3.3 Building C API Client Programs Using pkg-config
3.4 Writing C API Threaded Client Programs
3.5 Running C API Client Programs
3.6 Using C API Features
3.6.1 Support for Encrypted Connections
3.6.2 SSL Session Reuse
3.6.3 Multiple Statement Execution Support
3.6.4 Prepared Statement Handling of Date and Time Values
3.6.5 Prepared CALL Statement Support
3.6.6 Prepared Statement Problems
3.6.7 Optional Result Set Metadata
3.6.8 Automatic Reconnection Control
3.6.9 NULL mysql_store_result() Return After mysql_query() Success
3.6.10 Results Available from a Query
3.6.11 Obtaining the Unique ID for the Last Inserted Row
3.6.12 Obtaining the Server Version and Client Library Version
4 C API Function Reference
5 C API Basic Interface
5.1 Overview of the C API Basic Interface
5.2 C API Basic Data Structures
5.3 C API Basic Function Reference
5.4 C API Basic Function Descriptions
5.4.1 mysql_affected_rows()
5.4.2 mysql_autocommit()
5.4.3 mysql_bind_param()
5.4.4 mysql_change_user()
5.4.5 mysql_character_set_name()
5.4.6 mysql_close()
5.4.7 mysql_commit()
5.4.8 mysql_connect()
5.4.9 mysql_create_db()
5.4.10 mysql_data_seek()
5.4.11 mysql_debug()
5.4.12 mysql_drop_db()
5.4.13 mysql_dump_debug_info()
5.4.14 mysql_eof()
5.4.15 mysql_errno()
5.4.16 mysql_error()
5.4.17 mysql_escape_string()
5.4.18 mysql_fetch_field()
5.4.19 mysql_fetch_field_direct()
5.4.20 mysql_fetch_fields()
5.4.21 mysql_fetch_lengths()
5.4.22 mysql_fetch_row()
5.4.23 mysql_field_count()
5.4.24 mysql_field_seek()
5.4.25 mysql_field_tell()
5.4.26 mysql_free_result()
5.4.27 mysql_free_ssl_session_data()
5.4.28 mysql_get_character_set_info()
5.4.29 mysql_get_client_info()
5.4.30 mysql_get_client_version()
5.4.31 mysql_get_host_info()
5.4.32 mysql_get_option()
5.4.33 mysql_get_proto_info()
5.4.34 mysql_get_server_info()
5.4.35 mysql_get_server_version()
5.4.36 mysql_get_ssl_cipher()
5.4.37 mysql_get_ssl_session_data()
5.4.38 mysql_get_ssl_session_reused()
5.4.39 mysql_hex_string()
5.4.40 mysql_info()
5.4.41 mysql_init()
5.4.42 mysql_insert_id()
5.4.43 mysql_kill()
5.4.44 mysql_library_end()
5.4.45 mysql_library_init()
5.4.46 mysql_list_dbs()
5.4.47 mysql_list_fields()
5.4.48 mysql_list_processes()
5.4.49 mysql_list_tables()
5.4.50 mysql_more_results()
5.4.51 mysql_next_result()
5.4.52 mysql_num_fields()
5.4.53 mysql_num_rows()
5.4.54 mysql_options()
5.4.55 mysql_options4()
5.4.56 mysql_ping()
5.4.57 mysql_query()
5.4.58 mysql_real_connect()
5.4.59 mysql_real_connect_dns_srv()
5.4.60 mysql_real_escape_string()
5.4.61 mysql_real_escape_string_quote()
5.4.62 mysql_real_query()
5.4.63 mysql_refresh()
5.4.64 mysql_reload()
5.4.65 mysql_reset_connection()
5.4.66 mysql_reset_server_public_key()
5.4.67 mysql_result_metadata()
5.4.68 mysql_rollback()
5.4.69 mysql_row_seek()
5.4.70 mysql_row_tell()
5.4.71 mysql_select_db()
5.4.72 mysql_server_end()
5.4.73 mysql_server_init()
5.4.74 mysql_session_track_get_first()
5.4.75 mysql_session_track_get_next()
5.4.76 mysql_set_character_set()
5.4.77 mysql_set_local_infile_default()
5.4.78 mysql_set_local_infile_handler()
5.4.79 mysql_set_server_option()
5.4.80 mysql_shutdown()
5.4.81 mysql_sqlstate()
5.4.82 mysql_ssl_set()
5.4.83 mysql_stat()
5.4.84 mysql_store_result()
5.4.85 mysql_thread_id()
5.4.86 mysql_use_result()
5.4.87 mysql_warning_count()
6 C API Prepared Statement Interface
6.1 Overview of the C API Prepared Statement Interface
6.2 C API Prepared Statement Data Structures
6.2.1 C API Prepared Statement Type Codes
6.2.2 C API Prepared Statement Type Conversions
6.3 C API Prepared Statement Function Reference
6.4 C API Prepared Statement Function Descriptions
6.4.1 mysql_stmt_affected_rows()
6.4.2 mysql_stmt_attr_get()
6.4.3 mysql_stmt_attr_set()
6.4.4 mysql_stmt_bind_named_param()
6.4.5 mysql_stmt_bind_param()
6.4.6 mysql_stmt_bind_result()
6.4.7 mysql_stmt_close()
6.4.8 mysql_stmt_data_seek()
6.4.9 mysql_stmt_errno()
6.4.10 mysql_stmt_error()
6.4.11 mysql_stmt_execute()
6.4.12 mysql_stmt_fetch()
6.4.13 mysql_stmt_fetch_column()
6.4.14 mysql_stmt_field_count()
6.4.15 mysql_stmt_free_result()
6.4.16 mysql_stmt_init()
6.4.17 mysql_stmt_insert_id()
6.4.18 mysql_stmt_next_result()
6.4.19 mysql_stmt_num_rows()
6.4.20 mysql_stmt_param_count()
6.4.21 mysql_stmt_param_metadata()
6.4.22 mysql_stmt_prepare()
6.4.23 mysql_stmt_reset()
6.4.24 mysql_stmt_result_metadata()
6.4.25 mysql_stmt_row_seek()
6.4.26 mysql_stmt_row_tell()
6.4.27 mysql_stmt_send_long_data()
6.4.28 mysql_stmt_sqlstate()
6.4.29 mysql_stmt_store_result()
7 C API Asynchronous Interface
7.1 Overview of the C API Asynchronous Interface
7.2 C API Asynchronous Interface Data Structures
7.3 C API Asynchronous Function Reference
7.4 C API Asynchronous Function Descriptions
7.4.1 mysql_fetch_row_nonblocking()
7.4.2 mysql_free_result_nonblocking()
7.4.3 mysql_get_connect_nonblocking_stage()
7.4.4 mysql_next_result_nonblocking()
7.4.5 mysql_real_connect_nonblocking()
7.4.6 mysql_real_query_nonblocking()
7.4.7 mysql_reset_connection_nonblocking()
7.4.8 mysql_store_result_nonblocking()
8 C API Thread Interface
8.1 C API Thread Function Reference
8.2 C API Threaded Function Descriptions
8.2.1 mysql_thread_end()
8.2.2 mysql_thread_init()
8.2.3 mysql_thread_safe()
9 C API Client Plugin Interface
9.1 C API Plugin Function Reference
9.2 C API Plugin Function Descriptions
9.2.1 mysql_client_find_plugin()
9.2.2 mysql_client_register_plugin()
9.2.3 mysql_plugin_get_option()
9.2.4 mysql_load_plugin()
9.2.5 mysql_load_plugin_v()
9.2.6 mysql_plugin_options()
10 C API Binary Log Interface
10.1 Overview of the C API Binary Log Interface
10.2 C API Binary Log Data Structures
10.3 C API Binary Log Function Reference
10.4 C API Binary Log Function Descriptions
10.4.1 mysql_binlog_close()
10.4.2 mysql_binlog_fetch()
10.4.3 mysql_binlog_open()
Index