MySQL 8.0 C API Developer Guide

Abstract

This is the MySQL 8.0 C API Developer Guide. This document accompanies MySQL 8.0 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: 2020-08-06 (revision: 66913)

Table of Contents

Preface and Legal Notices
1 The MySQL C API
2 MySQL C API Implementations
3 Example C API Client Programs
4 Building and Running C API Client Programs
4.1 Building C API Client Programs
4.2 Building C API Client Programs Using pkg-config
4.3 Writing C API Threaded Client Programs
4.4 Running C API Client Programs
4.5 C API Server Version and Client Library Version
5 C API Data Structures
6 C API Function Overview
7 C API Function Descriptions
7.1 mysql_affected_rows()
7.2 mysql_autocommit()
7.3 mysql_change_user()
7.4 mysql_character_set_name()
7.5 mysql_close()
7.6 mysql_commit()
7.7 mysql_connect()
7.8 mysql_create_db()
7.9 mysql_data_seek()
7.10 mysql_debug()
7.11 mysql_drop_db()
7.12 mysql_dump_debug_info()
7.13 mysql_eof()
7.14 mysql_errno()
7.15 mysql_error()
7.16 mysql_escape_string()
7.17 mysql_fetch_field()
7.18 mysql_fetch_field_direct()
7.19 mysql_fetch_fields()
7.20 mysql_fetch_lengths()
7.21 mysql_fetch_row()
7.22 mysql_field_count()
7.23 mysql_field_seek()
7.24 mysql_field_tell()
7.25 mysql_free_result()
7.26 mysql_get_character_set_info()
7.27 mysql_get_client_info()
7.28 mysql_get_client_version()
7.29 mysql_get_host_info()
7.30 mysql_get_option()
7.31 mysql_get_proto_info()
7.32 mysql_get_server_info()
7.33 mysql_get_server_version()
7.34 mysql_get_ssl_cipher()
7.35 mysql_hex_string()
7.36 mysql_info()
7.37 mysql_init()
7.38 mysql_insert_id()
7.39 mysql_kill()
7.40 mysql_library_end()
7.41 mysql_library_init()
7.42 mysql_list_dbs()
7.43 mysql_list_fields()
7.44 mysql_list_processes()
7.45 mysql_list_tables()
7.46 mysql_more_results()
7.47 mysql_next_result()
7.48 mysql_num_fields()
7.49 mysql_num_rows()
7.50 mysql_options()
7.51 mysql_options4()
7.52 mysql_ping()
7.53 mysql_query()
7.54 mysql_real_connect()
7.55 mysql_real_connect_dns_srv()
7.56 mysql_real_escape_string()
7.57 mysql_real_escape_string_quote()
7.58 mysql_real_query()
7.59 mysql_refresh()
7.60 mysql_reload()
7.61 mysql_reset_connection()
7.62 mysql_reset_server_public_key()
7.63 mysql_result_metadata()
7.64 mysql_rollback()
7.65 mysql_row_seek()
7.66 mysql_row_tell()
7.67 mysql_select_db()
7.68 mysql_server_end()
7.69 mysql_server_init()
7.70 mysql_session_track_get_first()
7.71 mysql_session_track_get_next()
7.72 mysql_set_character_set()
7.73 mysql_set_local_infile_default()
7.74 mysql_set_local_infile_handler()
7.75 mysql_set_server_option()
7.76 mysql_shutdown()
7.77 mysql_sqlstate()
7.78 mysql_ssl_set()
7.79 mysql_stat()
7.80 mysql_store_result()
7.81 mysql_thread_id()
7.82 mysql_use_result()
7.83 mysql_warning_count()
8 C API Prepared Statements
9 C API Prepared Statement Data Structures
9.1 C API Prepared Statement Type Codes
9.2 C API Prepared Statement Type Conversions
10 C API Prepared Statement Function Overview
11 C API Prepared Statement Function Descriptions
11.1 mysql_stmt_affected_rows()
11.2 mysql_stmt_attr_get()
11.3 mysql_stmt_attr_set()
11.4 mysql_stmt_bind_param()
11.5 mysql_stmt_bind_result()
11.6 mysql_stmt_close()
11.7 mysql_stmt_data_seek()
11.8 mysql_stmt_errno()
11.9 mysql_stmt_error()
11.10 mysql_stmt_execute()
11.11 mysql_stmt_fetch()
11.12 mysql_stmt_fetch_column()
11.13 mysql_stmt_field_count()
11.14 mysql_stmt_free_result()
11.15 mysql_stmt_init()
11.16 mysql_stmt_insert_id()
11.17 mysql_stmt_next_result()
11.18 mysql_stmt_num_rows()
11.19 mysql_stmt_param_count()
11.20 mysql_stmt_param_metadata()
11.21 mysql_stmt_prepare()
11.22 mysql_stmt_reset()
11.23 mysql_stmt_result_metadata()
11.24 mysql_stmt_row_seek()
11.25 mysql_stmt_row_tell()
11.26 mysql_stmt_send_long_data()
11.27 mysql_stmt_sqlstate()
11.28 mysql_stmt_store_result()
12 C API Asynchronous Interface
13 C API Asynchronous Interface Data Structures
14 C API Asynchronous Function Overview
15 C API Asynchronous Function Descriptions
15.1 mysql_fetch_row_nonblocking()
15.2 mysql_free_result_nonblocking()
15.3 mysql_next_result_nonblocking()
15.4 mysql_real_connect_nonblocking()
15.5 mysql_real_query_nonblocking()
15.6 mysql_store_result_nonblocking()
16 C API Threaded Function Descriptions
16.1 mysql_thread_end()
16.2 mysql_thread_init()
16.3 mysql_thread_safe()
17 C API Client Plugin Functions
17.1 mysql_client_find_plugin()
17.2 mysql_client_register_plugin()
17.3 mysql_load_plugin()
17.4 mysql_load_plugin_v()
17.5 mysql_plugin_options()
18 C API Binary Log Interface
19 C API Binary Log Data Structures
20 C API Binary Log Function Overview
21 C API Binary Log Function Descriptions
21.1 mysql_binlog_close()
21.2 mysql_binlog_fetch()
21.3 mysql_binlog_open()
22 C API Support for Encrypted Connections
23 C API Multiple Statement Execution Support
24 C API Prepared Statement Handling of Date and Time Values
25 C API Prepared CALL Statement Support
26 C API Prepared Statement Problems
27 C API Optional Result Set Metadata
28 C API Automatic Reconnection Control
29 C API Common Issues
29.1 Why mysql_store_result() Sometimes Returns NULL After mysql_query() Returns Success
29.2 What Results You Can Get from a Query
29.3 How to Get the Unique ID for the Last Inserted Row
Index