class data_base : string -> string -> string ->
object
.. end
The class which represents a connection to a database.
The connection occurs when the object is created.
Raises SQL_Error
if an error occured during the connection to the database.
method connect : unit -> unit
Deprecated.The connection to the database oocurs when the object is created.
method disconnect : unit -> unit
Disconnect from the database. The objet should not be used after calling this method.
Raises SQL_Error
if an error occurs while disconnecting.
method execute : string -> int * string list list
#execute q
executes query q
and
returns the result as a pair (error_code, recordlist)
,
where a record is a string list
. The error_code
is 0
if no error occured.
method execute_with_info : string -> int * (string * sql_column_type) list * string list list
#execute_with_info q
executes query q
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.
method execute_gen : ?get_info:bool ->
?n_rec:int ->
string ->
(string list list -> unit) -> int * (string * sql_column_type) list
#execute_gen get_info n_rec q callback
executes query q
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
.