text
stringlengths
0
234
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_1_NAME, -- content
Value => Object.Content);
Object.Clear_Modified (3);
end if;
if Stmt.Has_Save_Fields then
Object.Version := Object.Version + 1;
Stmt.Save_Field (Name => "version",
Value => Object.Version);
Stmt.Set_Filter (Filter => "id = ? and version = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Add_Param (Value => Object.Version - 1);
declare
Result : Integer;
begin
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 (Status_Type);
Impl : Host_Access;
begin
Set_Field (Object, Impl);
Set_Field_Enum (Impl.all, 9, Impl.Status, Value);
end Set_Status;
function Get_Status (Object : in Host_Ref)
return Hyperion.Hosts.Models.Status_Type is
Impl : constant Host_Access
:= Host_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Status;
end Get_Status;
procedure Set_Agent (Object : in out Host_Ref;
Value : in Hyperion.Agents.Models.Agent_Ref'Class) is
Impl : Host_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 10, Impl.Agent, Value);
end Set_Agent;
function Get_Agent (Object : in Host_Ref)
return Hyperion.Agents.Models.Agent_Ref'Class is
Impl : constant Host_Access
:= Host_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Agent;
end Get_Agent;
-- Copy of the object.
procedure Copy (Object : in Host_Ref;
Into : in out Host_Ref) is
Result : Host_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Host_Access
:= Host_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Host_Access
:= new Host_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Version := Impl.Version;
Copy.Name := Impl.Name;
Copy.Ip := Impl.Ip;
Copy.Key := Impl.Key;
Copy.Create_Date := Impl.Create_Date;
Copy.Serial := Impl.Serial;
Copy.Description := Impl.Description;
Copy.Status := Impl.Status;
Copy.Agent := Impl.Agent;
Function Definition: procedure Unchecked_Free is new Ada.Unchecked_Deallocation
Function Body: (Host_Impl, Host_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Host_Impl_Ptr := Host_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out Host_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, HOST_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);