module Ocamlodbc:Interface to ODBC databases.sig
..end
See http://home.gna.org/ocamlodbc/configuring.html for
configutation information.
val version : string
exception SQL_Error of string
type
sql_column_type =
| |
SQL_unknown |
| |
SQL_char |
| |
SQL_numeric |
| |
SQL_decimal |
| |
SQL_integer |
| |
SQL_smallint |
| |
SQL_float |
| |
SQL_real |
| |
SQL_double |
| |
SQL_varchar |
| |
SQL_date |
| |
SQL_time |
| |
SQL_timestamp |
| |
SQL_longvarchar |
| |
SQL_binary |
| |
SQL_varbinary |
| |
SQL_longvarbinary |
| |
SQL_bigint |
| |
SQL_tinyint |
| |
SQL_bit |
module SQL_column:sig
..end
type
connection
val connect : string -> string -> string -> connection
connect base user passwd
creates a connection to data source
base
, as user user
, with password passwd
.SQL_Error
if the connection to the database failed.val connect_driver : ?prompt:bool -> string -> connection
connect_driver conn_string
exposes the SQLDriverConnect
function to OCaml (for ODBC v2 or greater under MinGW). This
allows SQLServer "trusted authentication" mode based on NT
domain identities. An example of conn_string
is "Driver={SQL
Server};SERVER=FOOSERVER;Trusted_Connection=yes;Database=MYDB"
.SQL_Error
if the connection to the database failed.prompt
: tells whether the if the driver should raise a
dialog box to request username and password. Default: false
.val disconnect : connection -> unit
SQL_Error
if an error occured while disconnecting.val execute : connection -> string -> int * string option list list
execute c q
executes query q
through connection c
and
returns the result as a pair (error_code, recordlist)
, where a
record is a string option list
. The error_code
is 0 if no
error occured. Each field of a record can be None
, which
represents the SQL NULL, or Some v
where v
is a string holding
the field value.val execute_with_info : connection ->
string ->
int * (string * sql_column_type) list * string option list list
execute_with_info c q
executes query q
through connection c
and
returns the result as a tuple (error_code, type_list, record list)
,
where type_list
indicates the SQL types of the returned columns,
and a record is a string list
.
The error_code
is >= 0
if no error occured.val execute_gen : connection ->
?get_info:bool ->
?n_rec:int ->
string ->
(string option list list -> unit) ->
int * (string * sql_column_type) list
execute_gen c get_info n_rec q callback
executes query q
over
the connection c
, and invokes callback
on successful blocks of
the results (of n_rec
records each). Each record is a string
list
of fields.
The result is a tuple (error_code, type_list)
. The
error_code
is >= 0
if no error occurred, type_list
is
empty if get_info
is false
.
class data_base :string -> string -> string ->
object
..end