text
stringlengths
0
234
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 Session_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (SESSION_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_4_NAME, -- start_date
Value => Object.Start_Date);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_4_NAME, -- end_date
Value => Object.End_Date);
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_4_NAME, -- ip_address
Value => Object.Ip_Address);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_4_NAME, -- stype
Value => Integer (Session_Type'Pos (Object.Stype)));
Object.Clear_Modified (4);
end if;
if Object.Is_Modified (6) then
Stmt.Save_Field (Name => COL_5_4_NAME, -- server_id
Value => Object.Server_Id);
Object.Clear_Modified (6);
end if;
if Object.Is_Modified (7) then
Stmt.Save_Field (Name => COL_6_4_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (7);
end if;
if Object.Is_Modified (8) then
Stmt.Save_Field (Name => COL_7_4_NAME, -- auth_id
Value => Object.Auth);
Object.Clear_Modified (8);
end if;
if Object.Is_Modified (9) then
Stmt.Save_Field (Name => COL_8_4_NAME, -- user_id
Value => Object.User);
Object.Clear_Modified (9);
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_Permission (Object : in out Acl_Ref;
Function Body: Value : in ADO.Identifier) is
Impl : Acl_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Identifier (Impl.all, 7, Impl.Permission, Value);
end Set_Permission;
function Get_Permission (Object : in Acl_Ref)
return ADO.Identifier is
Impl : constant Acl_Access
:= Acl_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Permission;
end Get_Permission;
-- Copy of the object.
procedure Copy (Object : in Acl_Ref;
Into : in out Acl_Ref) is
Result : Acl_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Acl_Access
:= Acl_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Acl_Access
:= new Acl_Impl;