Library
Module
Module type
Parameter
Class
Class type
Low level binding to the DB-lib part of freetds. These bindings mimic the C API and therefore some functions must be used in the right order. Look at the FreeTDS User Guide and Sybase documentation for fine points. Use OCamlDBI with the freetds driver for an easier interaction with such databases.
Value that contains all information needed by Freetds.Dblib
to manage communications with the server.
val connect :
?user:string ->
?password:string ->
?charset:string ->
?language:string ->
?application:string ->
string ->
dbprocess
connect server
: open a connection to the given database server.
val close : dbprocess -> unit
dbclose conn
close the connection conn
to the server.
val use : dbprocess -> string -> unit
dbuse conn name
change the current database to name
.
val name : dbprocess -> string
name conn
returns the name of the current database.
val sqlexec : dbprocess -> string -> unit
Send the SQL command to the server and wait for an answer.
val cancel : dbprocess -> unit
Cancel the current command batch.
val canquery : dbprocess -> unit
Cancel the query currently being retrieved, (retriving and) discarding all pending rows.
val results : dbprocess -> bool
results conn
returns true
if some results are available and false
if the query produced no results. There may be several results if COMPUTE clauses are used. One MUST CALL this function before trying to retrieve any rows.
val numcols : dbprocess -> int
Return number of regular columns in a result set.
val colname : dbprocess -> int -> string
colname conn c
returns the name of a regular result column c
. The first column has number 1.
val string_of_col_type : col_type -> string
Returns a string description of the column type.
type data =
| NULL
| STRING of string
| TINY of int
| SMALL of int
| INT of int
| INT32 of int32
| INT64 of string
| FLOAT of float
| DATETIME of int * int * int * int * int * int * int * int
(year, month, day, hour, minute, second, millisecond, zone)
*)| MONEY of float
| BIT of bool
| BINARY of string
| NUMERIC of string
| DECIMAL of string
val string_of_data : data -> string
val count : dbprocess -> int
Get count of rows processed.
exception Error of severity * string
Error(severity, err, message)
is raised on dblib errors. You can change the reaction to some errors by installing your own handler with err_handler
.
val err_handler : (severity -> int -> string -> unit) -> unit
err_handler f
installs f
as the default error handler for non-OS related errors and errors not coming from the server. f
is given the severity
, the number of the error (see the 400 or so error numbers sybdb.h, macros SYBE...) and the message.