text stringlengths 0 234 |
|---|
:= Wiki_Content_Impl (Object.Get_Load_Object.all)'Access; |
begin |
return Impl.Page; |
end Get_Page; |
procedure Set_Author (Object : in out Wiki_Content_Ref; |
Value : in AWA.Users.Models.User_Ref'Class) is |
Impl : Wiki_Content_Access; |
begin |
Set_Field (Object, Impl); |
ADO.Objects.Set_Field_Object (Impl.all, 9, Impl.Author, Value); |
end Set_Author; |
function Get_Author (Object : in Wiki_Content_Ref) |
return AWA.Users.Models.User_Ref'Class is |
Impl : constant Wiki_Content_Access |
:= Wiki_Content_Impl (Object.Get_Load_Object.all)'Access; |
begin |
return Impl.Author; |
end Get_Author; |
-- Copy of the object. |
procedure Copy (Object : in Wiki_Content_Ref; |
Into : in out Wiki_Content_Ref) is |
Result : Wiki_Content_Ref; |
begin |
if not Object.Is_Null then |
declare |
Impl : constant Wiki_Content_Access |
:= Wiki_Content_Impl (Object.Get_Load_Object.all)'Access; |
Copy : constant Wiki_Content_Access |
:= new Wiki_Content_Impl; |
begin |
ADO.Objects.Set_Object (Result, Copy.all'Access); |
Copy.Copy (Impl.all); |
Copy.Create_Date := Impl.Create_Date; |
Copy.Content := Impl.Content; |
Copy.Format := Impl.Format; |
Copy.Save_Comment := Impl.Save_Comment; |
Copy.Version := Impl.Version; |
Copy.Page_Version := Impl.Page_Version; |
Copy.Page := Impl.Page; |
Copy.Author := Impl.Author; |
Function Definition: procedure Unchecked_Free is new Ada.Unchecked_Deallocation |
Function Body: (Wiki_Content_Impl, Wiki_Content_Impl_Ptr); |
pragma Warnings (Off, "*redundant conversion*"); |
Ptr : Wiki_Content_Impl_Ptr := Wiki_Content_Impl (Object.all)'Access; |
pragma Warnings (On, "*redundant conversion*"); |
begin |
Unchecked_Free (Ptr); |
end Destroy; |
procedure Find (Object : in out Wiki_Content_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, WIKI_CONTENT_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 Wiki_Content_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 Wiki_Content_Impl; |
Session : in out ADO.Sessions.Master_Session'Class) is |
Stmt : ADO.Statements.Update_Statement |
:= Session.Create_Statement (WIKI_CONTENT_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 (7) then |
Stmt.Save_Field (Name => COL_6_3_NAME, -- page_version |
Value => Object.Page_Version); |
Object.Clear_Modified (7); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.