Next Previous Contents

2. _mysql module

If you want to write applications which are portable across databases, avoid using this module directly. _mysql provides an interface which mostly implements the MySQL C API. For more information, see the MySQL documentation. The documentation for this module is intentionally weak because you probably should use the higher-level MySQLdb module. If you really need it, use the standard MySQL docs and transliterate as necessary.

The C API has been wrapped in an object-oriented way. The only MySQL data structures which are implemented are the MYSQL (database connection handle) and MYSQL_RES (result handle) types. In general, any function which takes MYSQL *mysql as an argument is now a method of the connection object, and any function which takes MYSQL_RES *result as an argument is a method of the result object. Functions requiring none of the MySQL data structures are implemented as functions in the module. Functions requiring one of the other MySQL data structures are generally not implemented. Deprecated functions are not implemented. In all cases, the mysql_ prefix is dropped from the name. Most of the conn methods listed are also available as MySQLdb Connection object methods. Their use is explicitly non-portable.


C API
_mysql
mysql_affected_rows() conn.affected_rows()
mysql_close() conn.close()
mysql_connect() _mysql.connect()
mysql_data_seek() result.data_seek()
mysql_debug() _mysql.debug()
mysql_dump_debug_info conn.dump_debug_info()
mysql_escape_string() _mysql.escape_string()
mysql_fetch_row() result.fetch_row()
result_fetch_row_as_dict()
result.fetch_rows()
result.fetch_rows_as_dict()
result.fetch_all_rows()
result.fetch_all_rows_as_dict()
mysql_get_client_info() _mysql.get_client_info()
mysql_get_host_info() conn.get_host_info()
mysql_get_proto_info() conn.get_proto_info()
mysql_get_server_info() conn.get_server_info()
mysql_info() conn.info()
mysql_insert_id() conn.insert_id()
mysql_list_dbs() conn.list_dbs()
mysql_list_fields() conn.list_fields()
mysql_list_processes() conn.list_processes()
mysql_list_tables() conn.list_tables()
mysql_num_fields() result.num_fields()
mysql_num_rows() result.num_rows()
mysql_ping() conn.ping()
mysql_query() conn.query()
mysql_real_connect() _mysql.connect()
mysql_real_query() conn.query()
mysql_row_seek() result.row_seek()
mysql_row_tell() result.row_tell()
mysql_select_db() conn.select_db()
mysql_stat() conn.stat()
mysql_store_result() conn.store_result()
mysql_thread_id() conn.thread_id()
mysql_use_result() conn.use_result()
CLIENT_* _mysql.CLIENT.*
CR_* _mysql.CR.*
ER_* _mysql.ER.*
FIELD_TYPE_* _mysql.FIELD_TYPE.*
FLAG_* _mysql.FLAG.*
MySQL C API function mapping

Next Previous Contents