text
stringlengths
0
234
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
else
raise ADO.Objects.LAZY_LOCK;
end if;
end if;
Function Definition: procedure Set_Field_Enum is
Function Body: new ADO.Objects.Set_Field_Operation (Key_Type);
Impl : Access_Key_Access;
begin
Set_Field (Object, Impl);
Set_Field_Enum (Impl.all, 5, Impl.Kind, Value);
end Set_Kind;
function Get_Kind (Object : in Access_Key_Ref)
return AWA.Users.Models.Key_Type is
Impl : constant Access_Key_Access
:= Access_Key_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Kind;
end Get_Kind;
procedure Set_User (Object : in out Access_Key_Ref;
Value : in AWA.Users.Models.User_Ref'Class) is
Impl : Access_Key_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 6, Impl.User, Value);
end Set_User;
function Get_User (Object : in Access_Key_Ref)
return AWA.Users.Models.User_Ref'Class is
Impl : constant Access_Key_Access
:= Access_Key_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.User;
end Get_User;
-- Copy of the object.
procedure Copy (Object : in Access_Key_Ref;
Into : in out Access_Key_Ref) is
Result : Access_Key_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Access_Key_Access
:= Access_Key_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Access_Key_Access
:= new Access_Key_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Access_Key := Impl.Access_Key;
Copy.Expire_Date := Impl.Expire_Date;
Copy.Version := Impl.Version;
Copy.Kind := Impl.Kind;
Copy.User := Impl.User;
Function Definition: procedure Unchecked_Free is new Ada.Unchecked_Deallocation
Function Body: (Access_Key_Impl, Access_Key_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Access_Key_Impl_Ptr := Access_Key_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out Access_Key_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, ACCESS_KEY_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Access_Key_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;