package freetds

  1. Overview
  2. Docs
On This Page
  1. Connection
Legend:
Library
Module
Module type
Parameter
Class
Class type
exception End_results
exception End_data
exception Cancelled
exception Cmd_fail
exception Datatype_not_implemented
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 = [
  1. | `Clear
  2. | `Get
  3. | `Set
]

CS_CLEAR CS_GET and CS_SET

type string_property = [
  1. | `Appname
  2. | `Password
  3. | `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 = [
  1. | `Lang
  2. | `Rpc
]

CS_LANG and CS_RPC - rpc is currently not really implemented

  • you'll notice no ct_param wrapper
type cmd_option = [
  1. | `NoRecompile
  2. | `Recompile
]

Options for compiling CS_NORECOMPILE and CS_RECOMPILE

type result_type = [
  1. | `Cmd_done
  2. | `Cmd_fail
  3. | `Cmd_succeed
  4. | `Param
  5. | `Row
  6. | `Status
]

Result types; usually we only care about Row

type resinfo_type = [
  1. | `Cmd_number
  2. | `Numdata
  3. | `Row_count
]
type status = [
  1. | `CanBeNull
  2. | `Identity
  3. | `NoData
  4. | `Return
]
type column = {
  1. col_name : string;
  2. col_status : status list;
  3. col_buffer : binding_buffer;
}
type location = [
  1. | `Server
  2. | `Client
]

Types for fetching / inspecting errors

type severity = [
  1. | `Inform
  2. | `Api_fail
  3. | `Retry_fail
  4. | `Resource_fail
  5. | `Config_fail
  6. | `Comm_fail
  7. | `Internal_fail
  8. | `Fatal
]
type sql_t = [
  1. | `Bit of bool
  2. | `Tinyint of int
  3. | `Smallint of int
  4. | `Int of int32
  5. | `Text of string
  6. | `String of string
  7. | `Binary of string
  8. | `Float of float
  9. | `Datetime of string
  10. | `Decimal of string
  11. | `Null
]
val ctx_create : unit -> context

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

Command

val command : command -> cmd_type -> ?option:cmd_option -> string -> unit
val send : command -> unit
val results : command -> result_type

Results

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
OCaml

Innovation. Community. Security.