package mysql

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type dbd
type db = {
  1. dbhost : string option;
  2. dbname : string option;
  3. dbport : int option;
  4. dbpwd : string option;
  5. dbuser : string option;
  6. dbsocket : string option;
}
val defaults : db
type protocol =
  1. | PROTOCOL_DEFAULT
  2. | PROTOCOL_TCP
  3. | PROTOCOL_SOCKET
  4. | PROTOCOL_PIPE
  5. | PROTOCOL_MEMORY
type db_option =
  1. | OPT_COMPRESS
  2. | OPT_NAMED_PIPE
  3. | OPT_LOCAL_INFILE of bool
  4. | OPT_RECONNECT of bool
  5. | OPT_SSL_VERIFY_SERVER_CERT of bool
  6. | REPORT_DATA_TRUNCATION of bool
  7. | SECURE_AUTH of bool
  8. | OPT_PROTOCOL of protocol
  9. | OPT_CONNECT_TIMEOUT of int
  10. | OPT_READ_TIMEOUT of int
  11. | OPT_WRITE_TIMEOUT of int
  12. | INIT_COMMAND of string
  13. | READ_DEFAULT_FILE of string
  14. | READ_DEFAULT_GROUP of string
  15. | SET_CHARSET_DIR of string
  16. | SET_CHARSET_NAME of string
  17. | SHARED_MEMORY_BASE_NAME of string
  18. | OPT_FOUND_ROWS
val init : unit -> unit
val connect : ?options:db_option list -> db -> dbd
val quick_connect : ?options:db_option list -> ?host:string -> ?database:string -> ?port:int -> ?password:string -> ?user:string -> ?socket:string -> unit -> dbd
val set_charset : dbd -> string -> unit
val change_user : dbd -> db -> unit
val quick_change : ?user:string -> ?password:string -> ?database:string -> dbd -> unit
val select_db : dbd -> string -> unit
val disconnect : dbd -> unit
val ping : dbd -> unit
val list_dbs : dbd -> ?pat:string -> unit -> string array option
val client_info : unit -> string
val host_info : dbd -> string
val server_info : dbd -> string
val proto_info : dbd -> int
exception Error of string
type error_code =
  1. | Aborting_connection
  2. | Access_denied_error
  3. | Alter_info
  4. | Bad_db_error
  5. | Bad_field_error
  6. | Bad_host_error
  7. | Bad_null_error
  8. | Bad_table_error
  9. | Blob_cant_have_default
  10. | Blob_key_without_length
  11. | Blob_used_as_key
  12. | Blobs_and_no_terminated
  13. | Cant_create_db
  14. | Cant_create_file
  15. | Cant_create_table
  16. | Cant_create_thread
  17. | Cant_delete_file
  18. | Cant_drop_field_or_key
  19. | Cant_find_dl_entry
  20. | Cant_find_system_rec
  21. | Cant_find_udf
  22. | Cant_get_stat
  23. | Cant_get_wd
  24. | Cant_initialize_udf
  25. | Cant_lock
  26. | Cant_open_file
  27. | Cant_open_library
  28. | Cant_read_charset
  29. | Cant_read_dir
  30. | Cant_remove_all_fields
  31. | Cant_reopen_table
  32. | Cant_set_wd
  33. | Checkread
  34. | Columnaccess_denied_error
  35. | Commands_out_of_sync
  36. | Con_count_error
  37. | Conn_host_error
  38. | Connection_error
  39. | Db_create_exists
  40. | Db_drop_delete
  41. | Db_drop_exists
  42. | Db_drop_rmdir
  43. | Dbaccess_denied_error
  44. | Delayed_cant_change_lock
  45. | Delayed_insert_table_locked
  46. | Disk_full
  47. | Dup_entry
  48. | Dup_fieldname
  49. | Dup_key
  50. | Dup_keyname
  51. | Dup_unique
  52. | Empty_query
  53. | Error_on_close
  54. | Error_on_read
  55. | Error_on_rename
  56. | Error_on_write
  57. | Field_specified_twice
  58. | File_exists_error
  59. | File_not_found
  60. | File_used
  61. | Filsort_abort
  62. | Forcing_close
  63. | Form_not_found
  64. | Function_not_defined
  65. | Get_errno
  66. | Got_signal
  67. | Grant_wrong_host_or_user
  68. | Handshake_error
  69. | Hashchk
  70. | Host_is_blocked
  71. | Host_not_privileged
  72. | Illegal_grant_for_table
  73. | Illegal_ha
  74. | Insert_info
  75. | Insert_table_used
  76. | Invalid_default
  77. | Invalid_group_func_use
  78. | Invalid_use_of_null
  79. | Ipsock_error
  80. | Key_column_does_not_exits
  81. | Key_not_found
  82. | Kill_denied_error
  83. | Load_info
  84. | Localhost_connection
  85. | Mix_of_group_func_and_fields
  86. | Multiple_pri_key
  87. | Namedpipe_connection
  88. | Namedpipeopen_error
  89. | Namedpipesetstate_error
  90. | Namedpipewait_error
  91. | Net_error_on_write
  92. | Net_fcntl_error
  93. | Net_packet_too_large
  94. | Net_packets_out_of_order
  95. | Net_read_error
  96. | Net_read_error_from_pipe
  97. | Net_read_interrupted
  98. | Net_uncompress_error
  99. | Net_write_interrupted
  100. | Nisamchk
  101. | No
  102. | No_db_error
  103. | No_raid_compiled
  104. | No_such_index
  105. | No_such_table
  106. | No_such_thread
  107. | No_tables_used
  108. | No_unique_logfile
  109. | Non_uniq_error
  110. | Nonexisting_grant
  111. | Nonexisting_table_grant
  112. | Nonuniq_table
  113. | Normal_shutdown
  114. | Not_allowed_command
  115. | Not_form_file
  116. | Not_keyfile
  117. | Null_column_in_index
  118. | Old_keyfile
  119. | Open_as_readonly
  120. | Out_of_memory
  121. | Out_of_resources
  122. | Out_of_sortmemory
  123. | Outofmemory
  124. | Parse_error
  125. | Password_anonymous_user
  126. | Password_no_match
  127. | Password_not_allowed
  128. | Primary_cant_have_null
  129. | Ready
  130. | Record_file_full
  131. | Regexp_error
  132. | Requires_primary_key
  133. | Server_gone_error
  134. | Server_handshake_err
  135. | Server_lost
  136. | Server_shutdown
  137. | Shutdown_complete
  138. | Socket_create_error
  139. | Stack_overrun
  140. | Syntax_error
  141. | Table_cant_handle_auto_increment
  142. | Table_cant_handle_blob
  143. | Table_exists_error
  144. | Table_must_have_columns
  145. | Table_not_locked
  146. | Table_not_locked_for_write
  147. | Tableaccess_denied_error
  148. | Tcp_connection
  149. | Textfile_not_readable
  150. | Too_big_fieldlength
  151. | Too_big_rowsize
  152. | Too_big_select
  153. | Too_big_set
  154. | Too_long_ident
  155. | Too_long_key
  156. | Too_long_string
  157. | Too_many_delayed_threads
  158. | Too_many_fields
  159. | Too_many_key_parts
  160. | Too_many_keys
  161. | Too_many_rows
  162. | Too_many_tables
  163. | Udf_exists
  164. | Udf_no_paths
  165. | Unexpected_eof
  166. | Unknown_character_set
  167. | Unknown_com_error
  168. | Unknown_error
  169. | Unknown_host
  170. | Unknown_procedure
  171. | Unknown_table
  172. | Unsupported_extension
  173. | Update_info
  174. | Update_without_key_in_safe_mode
  175. | Version_error
  176. | Wrong_auto_key
  177. | Wrong_column_name
  178. | Wrong_db_name
  179. | Wrong_field_spec
  180. | Wrong_field_terminators
  181. | Wrong_field_with_group
  182. | Wrong_group_field
  183. | Wrong_host_info
  184. | Wrong_key_column
  185. | Wrong_mrg_table
  186. | Wrong_outer_join
  187. | Wrong_paramcount_to_procedure
  188. | Wrong_parameters_to_procedure
  189. | Wrong_sub_key
  190. | Wrong_sum_select
  191. | Wrong_table_name
  192. | Wrong_value_count
  193. | Wrong_value_count_on_row
  194. | Yes
type status =
  1. | StatusOK
  2. | StatusEmpty
  3. | StatusError of error_code
val status : dbd -> status
val errno : dbd -> error_code
val errmsg : dbd -> string option
type result
val exec : dbd -> string -> result
val fetch : result -> string option array option
val to_row : result -> int64 -> unit
val size : result -> int64
val iter : result -> f:(string option array -> unit) -> unit
val iter_col : result -> key:string -> f:(string option -> unit) -> unit
val iter_cols : result -> key:string array -> f:(string option array -> unit) -> unit
val map : result -> f:(string option array -> 'a) -> 'a list
val map_col : result -> key:string -> f:(string option -> 'a) -> 'a list
val map_cols : result -> key:string array -> f:(string option array -> 'a) -> 'a list
val column : result -> key:string -> row:string option array -> string option
type dbty =
  1. | IntTy
  2. | FloatTy
  3. | StringTy
  4. | SetTy
  5. | EnumTy
  6. | DateTimeTy
  7. | DateTy
  8. | TimeTy
  9. | YearTy
  10. | TimeStampTy
  11. | UnknownTy
  12. | Int64Ty
  13. | BlobTy
  14. | DecimalTy
type field = {
  1. name : string;
  2. table : string option;
  3. def : string option;
  4. ty : dbty;
  5. max_length : int;
  6. flags : int;
  7. decimals : int;
}
val pretty_type : dbty -> string
val affected : dbd -> int64
val insert_id : dbd -> int64
val fields : result -> int
val names : result -> string array
val types : result -> dbty array
val fetch_field : result -> field option
val fetch_fields : result -> field array option
val fetch_field_dir : result -> int -> field option
val escape : string -> string
val real_escape : dbd -> string -> string
val int2ml : string -> int
val decimal2ml : string -> string
val int322ml : string -> int32
val nativeint2ml : string -> nativeint
val int642ml : string -> int64
val float2ml : string -> float
val str2ml : string -> string
val enum2ml : string -> string
val blob2ml : string -> string
val set2ml : string -> string list
val datetime2ml : string -> int * int * int * int * int * int
val date2ml : string -> int * int * int
val time2ml : string -> int * int * int
val year2ml : string -> int
val timestamp2ml : string -> int * int * int * int * int * int
val opt : ('a -> 'b) -> 'a option -> 'b option
val not_null : ('a -> 'b) -> 'a option -> 'b
val ml2str : string -> string
val ml2rstr : dbd -> string -> string
val ml2blob : string -> string
val ml2rblob : dbd -> string -> string
val ml2int : int -> string
val ml2decimal : string -> string
val ml322int : int32 -> string
val ml642int : int64 -> string
val ml2float : float -> string
val ml2enum : string -> string
val ml2renum : dbd -> string -> string
val ml2set : string list -> string
val ml2rset : dbd -> string list -> string
val ml2datetime : (int * int * int * int * int * int) -> string
val ml2datetimel : year:int -> month:int -> day:int -> hour:int -> min:int -> sec:int -> string
val ml2date : (int * int * int) -> string
val ml2datel : year:int -> month:int -> day:int -> string
val ml2time : (int * int * int) -> string
val ml2timel : hour:int -> min:int -> sec:int -> string
val ml2year : int -> string
val ml2timestamp : (int * int * int * int * int * int) -> string
val ml2timestampl : year:int -> month:int -> day:int -> hour:int -> min:int -> sec:int -> string
val values : string list -> string
module Prepared : sig ... end