File : oci-thick-variable.adb
with OCI.Lib,System;
with OCI.Thread;
package body OCI.Thick.Variable is
use lib;
function Get_Value(Var : Variable'Class) return Variable_Type is
begin
if Is_Null(Var) then
raise NULL_VALUE;
else
return Var.Value;
end if;
end;
function Get_Value_Internal(Var : Variable'Class) return Variable_Type is
begin
return Var.Value;
end;
procedure Set_Value(Var : in out Variable; Value : Variable_Type) is
begin
Var.Indicator := 0;
Var.Value := Value;
end;
use type sb4;
procedure Bind(Stmt : Statement; Value : in out Variable; Name : String) is
rc : sword := OCIBindByName (
stmtp => OCIStmt(Stmt.Handle),
bindpp => Value.Bind'Access,
errhp => Thread.Error,
placeholder => C.To_C(Name),
placeh_len => Name'Length,
valuep => Value.Value'Address,
value_sz => Value.Value'Size/System.Storage_Unit,
dty => Type_Id,
indp => Value.Indicator'Access);
begin
Check_Error(rc);
end Bind;
procedure Bind(Stmt : Statement; Value : in out Variable; Position : Positive) is
rc : sword := OCIBindByPos (
stmtp => OCIStmt(Stmt.Handle),
bindpp => Value.Bind'Access,
errhp => Thread.Error,
Position => ub4(Position),
valuep => Value.Value'Address,
value_sz => Value.Value'Size/System.Storage_Unit,
dty => Type_Id,
indp => Value.Indicator'Access);
begin
Check_Error(rc);
end Bind;
procedure Define(Stmt : Statement; Value : in out Variable; Position : Positive) is
rc : sword := OCIDefineByPos (
stmtp => OCIStmt(Stmt.Handle),
defnpp => Value.Define'Access,
errhp => Thread.Error,
position => ub4(Position),
value => Value.Value'Address,
value_sz => Value.Value'Size/System.Storage_Unit,
dty => Type_Id,
indp => Value.Indicator'Access);
begin
Check_Error(rc);
end Define;
end OCI.Thick.Variable;