File : oci-task_error.adb
--with Text_IO, System.Address_Image; use Text_IO,System;
package body OCI.Task_Error is
use type sword,ub4;
use type OCIHandle;
procedure Free(H : OCIHandle; HType : Ub4) is
Rc : Sword;
begin
if H=Empty_Handle then
return;
end if;
RC := OCIHandleFree(H, HType);
if Rc/=OCI_SUCCESS then
null;
end if;
end Free;
function Create(Env : Thread_Environment) return Thread_Error is
HErr : aliased OCIHandle := Empty_Handle;
Rc : Sword := OCIHandleAlloc(Parenth => OCIHandle(Env.Environment),
Hndlpp => herr'access,
Htype => OCI_HTYPE_ERROR);
ERROR_HANDLE_CREATION_ERROR : exception;
begin
if Rc/=OCI_SUCCESS then
raise ERROR_HANDLE_CREATION_ERROR;
end if;
return (RF.Controlled_Reference with
Error => OCIError(Herr),
Environment => Env);
end Create;
procedure Destroy (Object : in out Thread_Error) is
begin
if Object.Error/=OCIError(Empty_Handle) then
Free(OCIHandle(Object.Error),OCI_HTYPE_Error);
end if;
end;
end OCI.Task_Error;