text
stringlengths
0
234
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, APPLICATION_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 Application_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 Application_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (APPLICATION_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_1_NAME, -- name
Value => Object.Name);
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_1_NAME, -- secret_key
Value => Object.Secret_Key);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_1_NAME, -- client_id
Value => Object.Client_Id);
Object.Clear_Modified (4);
end if;
if Object.Is_Modified (6) then
Stmt.Save_Field (Name => COL_5_1_NAME, -- create_date
Value => Object.Create_Date);
Object.Clear_Modified (6);
end if;
if Object.Is_Modified (7) then
Stmt.Save_Field (Name => COL_6_1_NAME, -- update_date
Value => Object.Update_Date);
Object.Clear_Modified (7);
end if;
if Object.Is_Modified (8) then
Stmt.Save_Field (Name => COL_7_1_NAME, -- title
Value => Object.Title);
Object.Clear_Modified (8);
end if;
if Object.Is_Modified (9) then
Stmt.Save_Field (Name => COL_8_1_NAME, -- description
Value => Object.Description);
Object.Clear_Modified (9);
end if;
if Object.Is_Modified (10) then
Stmt.Save_Field (Name => COL_9_1_NAME, -- app_login_url
Value => Object.App_Login_Url);
Object.Clear_Modified (10);
end if;
if Object.Is_Modified (11) then
Stmt.Save_Field (Name => COL_10_1_NAME, -- app_logo_url
Value => Object.App_Logo_Url);
Object.Clear_Modified (11);
end if;
if Object.Is_Modified (12) then
Stmt.Save_Field (Name => COL_11_1_NAME, -- user_id
Value => Object.User);
Object.Clear_Modified (12);
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;