text
stringlengths
0
234
Result : Message_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Message_Access
:= Message_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Message_Access
:= new Message_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Create_Date := Impl.Create_Date;
Copy.Priority := Impl.Priority;
Copy.Count := Impl.Count;
Copy.Parameters := Impl.Parameters;
Copy.Server_Id := Impl.Server_Id;
Copy.Task_Id := Impl.Task_Id;
Copy.Status := Impl.Status;
Copy.Processing_Date := Impl.Processing_Date;
Copy.Version := Impl.Version;
Copy.Entity_Id := Impl.Entity_Id;
Copy.Entity_Type := Impl.Entity_Type;
Copy.Finish_Date := Impl.Finish_Date;
Copy.Queue := Impl.Queue;
Copy.Message_Type := Impl.Message_Type;
Copy.User := Impl.User;
Copy.Session := Impl.Session;
Function Definition: procedure Unchecked_Free is new Ada.Unchecked_Deallocation
Function Body: (Message_Impl, Message_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Message_Impl_Ptr := Message_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out Message_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, MESSAGE_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 Message_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;
end if;
end Load;
procedure Save (Object : in out Message_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (MESSAGE_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_3_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_3_NAME, -- create_date
Value => Object.Create_Date);
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_3_NAME, -- priority
Value => Object.Priority);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_3_NAME, -- count
Value => Object.Count);
Object.Clear_Modified (4);
end if;
if Object.Is_Modified (5) then
Stmt.Save_Field (Name => COL_4_3_NAME, -- parameters
Value => Object.Parameters);
Object.Clear_Modified (5);
end if;
if Object.Is_Modified (6) then