text
stringlengths
0
234
Value : in Hyperion.Monitoring.Models.Snapshot_Ref'Class) is
Impl : Series_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 10, Impl.Snapshot, Value);
end Set_Snapshot;
function Get_Snapshot (Object : in Series_Ref)
return Hyperion.Monitoring.Models.Snapshot_Ref'Class is
Impl : constant Series_Access
:= Series_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Snapshot;
end Get_Snapshot;
-- Copy of the object.
procedure Copy (Object : in Series_Ref;
Into : in out Series_Ref) is
Result : Series_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Series_Access
:= Series_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Series_Access
:= new Series_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Version := Impl.Version;
Copy.Start_Date := Impl.Start_Date;
Copy.End_Date := Impl.End_Date;
Copy.Content := Impl.Content;
Copy.Count := Impl.Count;
Copy.First_Value := Impl.First_Value;
Copy.Format := Impl.Format;
Copy.Source := Impl.Source;
Copy.Snapshot := Impl.Snapshot;
Function Definition: procedure Unchecked_Free is new Ada.Unchecked_Deallocation
Function Body: (Series_Impl, Series_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Series_Impl_Ptr := Series_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out Series_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, SERIES_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 Series_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 Series_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (SERIES_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 (3) then
Stmt.Save_Field (Name => COL_2_3_NAME, -- start_date
Value => Object.Start_Date);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_3_NAME, -- end_date
Value => Object.End_Date);
Object.Clear_Modified (4);
end if;