text stringlengths 0 234 |
|---|
Found : out Boolean) is |
Stmt : ADO.Statements.Query_Statement |
:= Session.Create_Statement (Query, STORAGE_FOLDER_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 Storage_Folder_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 Storage_Folder_Impl; |
Session : in out ADO.Sessions.Master_Session'Class) is |
Stmt : ADO.Statements.Update_Statement |
:= Session.Create_Statement (STORAGE_FOLDER_DEF'Access); |
begin |
if Object.Is_Modified (1) then |
Stmt.Save_Field (Name => COL_0_2_NAME, -- id |
Value => Object.Get_Key); |
Object.Clear_Modified (1); |
end if; |
if Object.Is_Modified (3) then |
Stmt.Save_Field (Name => COL_2_2_NAME, -- create_date |
Value => Object.Create_Date); |
Object.Clear_Modified (3); |
end if; |
if Object.Is_Modified (4) then |
Stmt.Save_Field (Name => COL_3_2_NAME, -- name |
Value => Object.Name); |
Object.Clear_Modified (4); |
end if; |
if Object.Is_Modified (5) then |
Stmt.Save_Field (Name => COL_4_2_NAME, -- workspace_id |
Value => Object.Workspace); |
Object.Clear_Modified (5); |
end if; |
if Object.Is_Modified (6) then |
Stmt.Save_Field (Name => COL_5_2_NAME, -- owner_id |
Value => Object.Owner); |
Object.Clear_Modified (6); |
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 (Storage_Type); |
Impl : Storage_Access; |
begin |
Set_Field (Object, Impl); |
Set_Field_Enum (Impl.all, 1, Impl.Storage, Value); |
end Set_Storage; |
function Get_Storage (Object : in Storage_Ref) |
return AWA.Storages.Models.Storage_Type is |
Impl : constant Storage_Access |
:= Storage_Impl (Object.Get_Load_Object.all)'Access; |
begin |
return Impl.Storage; |
end Get_Storage; |
procedure Set_Create_Date (Object : in out Storage_Ref; |
Value : in Ada.Calendar.Time) is |
Impl : Storage_Access; |
begin |
Set_Field (Object, Impl); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.