Module Ct
module Ct: sig end
I've added this type to be an opaque "void*" type that will return a sql_t
exception End_results
exception End_data
exception Cancelled
exception Cmd_fail
exception Datatype_not_implemented
And this is for me to let you know I didn't wrap every datatype :-)
type binding_buffer
I've added this type to be an opaque "void*" type that will return a sql_t
type context
CS_CONTEXT
type connection
CS_CONNECTION
type command
CS_COMMAND
type prop_action = [ `Clear | `Get | `Set ]
CS_CLEAR CS_GET and CS_SET
type string_property = [ `Appname | `Password | `Username ]
CS_APPNAME, CS_PASSWORD, and CS_USERNAME - there are others but I've never used them...
Easy to add on demand; patches welcome
type cmd_type = [ `Lang | `Rpc ]
CS_LANG and CS_RPC - rpc is currently not really implemented
- you'll notice no ct_param wrapper
type cmd_option = [ `NoRecompile | `Recompile ]
Options for compiling CS_NORECOMPILE and CS_RECOMPILE
type result_type = [ `Cmd_done | `Cmd_fail | `Cmd_succeed | `Param | `Row | `Status ]
Result types; usually we only care about Row
type resinfo_type = [ `Cmd_number | `Numdata | `Row_count ]
type status = [ `CanBeNull | `Identity | `NoData | `Return ]
type column = {
}
type location = [ `Client | `Server ]
Types for fetching / inspecting errors
type severity = [ `Api_fail
| `Comm_fail
| `Config_fail
| `Fatal
| `Inform
| `Internal_fail
| `Resource_fail
| `Retry_fail ]
type sql_t = [ `Binary of string
| `Bit of bool
| `Datetime of string
| `Decimal of string
| `Float of float
| `Int of int32
| `Null
| `Smallint of int
| `String of string
| `Text of string
| `Tinyint of int ]
val ctx_create : unit -> context
Connection
val con_alloc : context -> connection
val con_setstring : connection -> string_property -> string -> unit
val connect : connection -> string -> unit
val close : ?force:bool -> connection -> unit
val cmd_alloc : connection -> command
val command : command -> cmd_type -> ?option:cmd_option -> string -> unit
val send : command -> unit
val results : command -> result_type
val res_info : command -> resinfo_type -> int
val fetch : command -> int
val bind : command -> ?maxlen:int -> int -> column
val buffer_contents : binding_buffer -> sql_t
val get_messages : connection -> location list -> (severity * string) list