Class Occi.statement


class statement : ?sql:string -> ora_connection -> object .. end
This class implements DML and DDL Oracle operations on a given connection descriptor. It should not be instantiated using it's own constructor, but rather via a connection#stmt call.

val stmt : ora_statement
val connection : ora_connection
method con : ora_connection
Get a connection object that this statement is bound to.
method select : ?sql:string ->
?max_rows:int option ->
param_val array ->
cursor option * string array * ora_value array list
Execute a SELECT query that can contain bind variables.
See also ora_select for more info.
Parameters:
sql : string
max_rows : int option
params : param_val array
method select_list : ?sql:string ->
?max_rows:int option ->
param_val array -> cursor option * ora_value array list
Execute a SELECT query that can contain bind variables.
Returns a list of records (up to max_rows).
See also ora_fetch_list for more info.
Parameters:
sql : string
max_rows : int option
params : param_val array
method fetch : ?max_rows:int option ->
cursor -> cursor option * ora_value array list
This method is used in combination with select when max_rows parameter is specified. In this case the cursor parameter returned by the select method can be fetched again to get the next max_rows rows as a list of records represented as arrays of fields.

Example:

          value stmt = con#stmt ~sql:"select * from test";
          let n = 10 in
          let (cursor, lst) = stmt#select ~max_rows:n in
            match cur with
            [ None     -> ()
            | Some cur -> (let rec f -> fun (c, l)  (ora_fetch_list cur ~max_rows:n)]
        

Parameters:
max_rows : int option
cursor : cursor
method foreach : ?params:param_val array ->
?sql:string -> (ora_value array -> unit) -> unit
Apply function f foreach record fetched from the given SQL select query
See also ora_fetch_foreach for details.
Parameters:
params : param_val array
sql : string
f : ora_value array -> unit
method execute : ?sql:string -> (int * param_val) list -> (int * ora_value) list
Execute a PL/SQL block.
See also occi_execute for details.
Parameters:
sql : string
params : (int * param_val) list
method execute_array : ?sql:string -> param_val array list -> int
Execute a bulk DML INSERT / UPDATE / DELETE
See also occi_execute_array for details.
Parameters:
sql : string
params : param_val array list
method prepare : string -> unit
Assign an SQL string to the statement
Parameters:
sql : string
method prepare_plsql : ?params:(int * param_val) list -> string -> unit
Assign an PL/SQL block to the statement. The block may contain bind variables
Parameters:
params : (int * param_val) list
sql : string
method update : ?sql:string -> param_val array -> int
Use this method to run an SQL INSERT / UPDATE / DELETE statement
Parameters:
sql : string
params : param_val array