Module MySQL


module MySQL: sig  end
MySQL module made using camlidl. Most functions simply wrap the MySQL C API.
See also MySQL C API.


type mysql_t

type mysql_res_t

type row_content

type row_offset

type err =
| CR_NO_ERROR
| CR_UNKNOWN_ERROR
| CR_SOCKET_CREATE_ERROR
| CR_CONNECTION_ERROR
| CR_CONN_HOST_ERROR
| CR_IPSOCK_ERROR
| CR_UNKNOWN_HOST
| CR_SERVER_GONE_ERROR
| CR_VERSION_ERROR
| CR_OUT_OF_MEMORY
| CR_WRONG_HOST_INFO
| CR_LOCALHOST_CONNECTION
| CR_TCP_CONNECTION
| CR_SERVER_HANDSHAKE_ERR
| CR_SERVER_LOST
| CR_COMMANDS_OUT_OF_SYNC
| CR_NAMEDPIPE_CONNECTION
| CR_NAMEDPIPEWAIT_ERROR
| CR_NAMEDPIPEOPEN_ERROR
| CR_NAMEDPIPESETSTATE_ERROR
| CR_CANT_READ_CHARSET
| CR_NET_PACKET_TOO_LARGE


type client_flag =
| CLIENT_LONG_PASSWORD
| CLIENT_FOUND_ROWS
| CLIENT_LONG_FLAG
| CLIENT_CONNECT_WITH_DB
| CLIENT_NO_SCHEMA
| CLIENT_COMPRESS
| CLIENT_ODBC
| CLIENT_LOCAL_FILES
| CLIENT_IGNORE_SPACE
| CLIENT_CHANGE_USER
| CLIENT_INTERACTIVE
| CLIENT_SSL
| CLIENT_IGNORE_SIGPIPE
| CLIENT_TRANSACTIONS


MySQL module made using camlidl. Most functions simply wrap the MySQL C API.

val my_init : unit -> unit
Initialize everything. This function is called when the module is loaded.
val mysql_init : unit -> mysql_t
Return a fresh mysql object.
val mysql_reinit : mysql_t -> unit
Re-initialize a mysql object.
val mysql_real_connect : mysql_t ->
string option ->
string option ->
string option ->
string option -> int -> string option -> client_flag list -> unit
val mysql_real_query : mysql_t -> string -> unit
val mysql_list_dbs : mysql_t -> string -> mysql_res_t
val mysql_list_tables : mysql_t -> string -> mysql_res_t
val mysql_list_fields : mysql_t -> string -> string -> mysql_res_t
val mysql_store_result : mysql_t -> mysql_res_t
val mysql_use_result : mysql_t -> mysql_res_t
val mysql_list_processes : mysql_t -> mysql_res_t
val mysql_field_count : mysql_t -> int
val mysql_affected_rows : mysql_t -> int
val mysql_num_rows : mysql_res_t -> int
val mysql_num_fields : mysql_res_t -> int
val mysql_stat : mysql_t -> string
val mysql_get_server_info : mysql_t -> string
val mysql_get_client_info : unit -> string
val mysql_get_host_info : mysql_t -> string
val mysql_get_proto_info : mysql_t -> int
val unsafe_mysql_fetch_row : mysql_res_t -> int -> row_content array
val mysql_fetch_row : mysql_res_t -> row_content array
val string_opt_of_rowcontent : row_content -> string option
val string_of_rowcontent : row_content -> string
val unsafe_mysql_fetch_lengths : mysql_res_t -> int -> int array
val mysql_fetch_lengths : mysql_res_t -> int array
val mysql_error : mysql_t -> string
val mysql_errno : mysql_t -> err
val mysql_ping : mysql_t -> unit
val mysql_thread_id : mysql_t -> int
val mysql_select_db : mysql_t -> string -> unit
val mysql_row_tell : mysql_res_t -> row_offset
val mysql_row_seek : mysql_res_t -> row_offset -> row_offset
val mysql_data_seek : mysql_res_t -> int -> unit


Higher level functions


val store_result_map : mysql_t -> string -> (string array -> 'a) -> 'a array
A map on rows of results which were obtained by mysql_store_result.
val store_result_iter : mysql_t -> string -> (string array -> unit) -> unit
An iter on rows of results which were obtained by mysql_store_result.
val store_result_fold : mysql_t -> string -> ('a -> string array -> 'a) -> 'a -> 'a
A fold on rows of results which were obtained by mysql_store_result.
val use_result_map : mysql_t -> string -> (string array -> 'a) -> 'a array
A map on rows of results which were obtained by mysql_store_result.
val use_result_iter : mysql_t -> string -> (string array -> unit) -> unit
An iter on rows of results which were obtained by mysql_store_result.
val use_result_fold : mysql_t -> string -> ('a -> string array -> 'a) -> 'a -> 'a
A fold on rows of results which were obtained by mysql_store_result.