File : oci-thick.ads


with
   Ada.Finalization,
   Oci.Lib,Reference_Finalization;

package OCI.Thick is
   
   use Lib; 

   subtype OCIDate is Lib.OCIDate;

   subtype OCINumber is Lib.OCINumber;
   
-- Base_Variable;
   
   type Base_Variable is tagged limited private;

   procedure Clear_Value(Var : in out Base_Variable'Class);
   function Is_Null(Var : Base_Variable'Class) return Boolean;
   
   INVALID_HANDLE : exception;
   LIB_ERROR      : exception;
   NULL_VALUE     : exception;
   NOT_ATTACHED   : exception; -- trying get not attached variable

-- OCIDate

   function To_String(From : OCIDate; Format : String) 
        return String;
   function SysDate return OCIDate;
        
   Init_OCIDate : constant OCIDate;

   type Handle_REference is abstract tagged private;
   function Handle(ref : Handle_REference'Class) return OCIHandle;
   pragma inline(Handle);
   
private

   package RF renames Reference_Finalization;


   type Handle_REference is abstract 
        new Rf.Controlled_Reference with record
      Handle : OCIHandle := Empty_Handle; 
   end record;

   package AF renames Ada.Finalization;

   type Base_Variable is
      new AF.Limited_Controlled with record
      Indicator : aliased Sb2 := Null_Indicator;
      Bind :   aliased OCIBind := OCIBind(Empty_Handle);
      Define : aliased OCIDefine := OCIDefine(Empty_Handle);
   end record;

   procedure Check_Error(Code : Sword);
   procedure Free(H : OCIHandle; HType : Ub4);
   function Alloc_Handle(Parent : OCIEnv; Htype : Ub4) return OCIHandle;

   Init_OCIDate : constant OCIDate := (
      OCIDateYYYY => 0, -- gregorian year; range is -4712 <= year <= 9999
      OCIDateMM   => 1, -- month; range is 1 <= month < 12
      OCIDateDD   => 1, -- day; range is 1 <= day <= 31
      OCIDateTime => (
         OCITimeHH => 0, -- hours; range is 0 <= hours <=23
         OCITimeMI => 0, -- minutes; range is 0 <= minutes <= 59
         OCITimeSS => 0) -- seconds; range is 0 <= seconds <= 59
     );    

end OCI.Thick