API Overview
The following list shows the function calls of the MySQL C API. Chapter 19 lists each of these methods with detailed prototype information, return values, and descriptions.
mysql_affected_rows( )
|
mysql_close( )
|
mysql_connect( )
|
mysql_create_db( )
|
mysql_data_seek( )
|
mysql_drop_db( )
|
mysql_eof( )
|
mysql_error( )
|
mysql_fetch_field( )
|
mysql_fetch_lengths( )
|
mysql_fetch_row( )
|
mysql_field_count( )
|
mysql_field_seek( )
|
mysql_free_result( )
|
mysql_get_client_info( )
|
mysql_get_host_info( )
|
mysql_get_proto_into( )
|
mysql_get_server_info( )
|
mysql_init( )
|
mysql_insert_id( )
|
mysql_list_dbs( )
|
mysql_list_fields( )
|
mysql_list_processes( )
|
mysql_list_tables( )
|
mysql_num_fields( )
|
mysql_num_rows( )
|
mysql_query( )
|
mysql_real_query( )
|
mysql_reload( )
|
mysql_select_db( )
|
mysql_shutdown( )
|
mysql_stat( )
|
mysql_store_result( )
|
mysql_use_result( )
|
You may notice that many of the function names do not seem directly related to accessing database data. In many cases, MySQL actually only provides an API interface into database administration functions. By reading the function names, you might have gathered that any database application you write might look something like this:
Connect |
Select DB |
Query |
Fetch row |
Fetch field |
Close |
Example 12-1 shows a simple select statement that retrieves data from a MySQL database using the MySQL C API.
#include <stdio.h> #include <mysql.h> int main(char ...
Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.