package freetds

  1. Overview
  2. Docs
On This Page
  1. Connection
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Freetds.CtSource

Sourceexception End_results
Sourceexception End_data
Sourceexception Cancelled
Sourceexception Cmd_fail
Sourceexception Datatype_not_implemented
Sourcetype binding_buffer

I've added this type to be an opaque "void*" type that will return a sql_t

Sourcetype context

CS_CONTEXT

Sourcetype connection

CS_CONNECTION

Sourcetype command

CS_COMMAND

Sourcetype prop_action = [
  1. | `Clear
  2. | `Get
  3. | `Set
]

CS_CLEAR CS_GET and CS_SET

Sourcetype 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

Sourcetype cmd_type = [
  1. | `Lang
  2. | `Rpc
]

CS_LANG and CS_RPC - rpc is currently not really implemented

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

Options for compiling CS_NORECOMPILE and CS_RECOMPILE

Sourcetype 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

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

Types for fetching / inspecting errors

Sourcetype severity = [
  1. | `Inform
  2. | `Api_fail
  3. | `Retry_fail
  4. | `Resource_fail
  5. | `Config_fail
  6. | `Comm_fail
  7. | `Internal_fail
  8. | `Fatal
]
Sourcetype 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
]
Sourceval ctx_create : unit -> context

Context

Connection
Sourceval con_alloc : context -> connection
Sourceval con_setstring : connection -> string_property -> string -> unit
Sourceval connect : connection -> string -> unit
Sourceval close : ?force:bool -> connection -> unit
Sourceval cmd_alloc : connection -> command

Command

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

Results

Sourceval res_info : command -> resinfo_type -> int
Sourceval fetch : command -> int
Sourceval bind : command -> ?maxlen:int -> int -> column
Sourceval buffer_contents : binding_buffer -> sql_t
Sourceval get_messages : connection -> location list -> (severity * string) list
OCaml

Innovation. Community. Security.