Update of /cvsroot/modeling/ProjectModeling/Modeling/doc/UserGuide
In directory sc8-pr-cvs1:/tmp/cvs-serv6273/doc/UserGuide
Modified Files:
ManipulatingGraphOfObjects.tex
Log Message:
Documented the influence of changes in a graph of objects/EC when fetching
Index: ManipulatingGraphOfObjects.tex
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/UserGuide/ManipulatingGraphOfObjects.tex,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** ManipulatingGraphOfObjects.tex 17 Jul 2003 12:39:40 -0000 1.14
--- ManipulatingGraphOfObjects.tex 17 Jul 2003 13:41:12 -0000 1.15
***************
*** 409,415 ****
\end{itemize}
! \subsection{The influence of an EditingContext on fetchs\label{ec-fetch-inserted-deleted-objects}}
- TBD
\subsection{Fetching raw rows\label{ec-fetch-raw-rows}}
--- 409,487 ----
\end{itemize}
! \subsection{The influence of an EditingContext on fetchs\label{ec-fetch-reflect-changes}}
!
! Each \class{EditingContext} holds a different graph of objects, isolated from
! the other, where modifications, insertions and deletions can be made
! independently until they are saved in the database.
!
! The state of a given \class{EditingContext} naturally have an impact on the
! objects you fetched. When nothing has been changed, you obviously get the
! objects as they are stored in the database. However, whenever you insert,
! modify or delete object, the result set of a fetch changes:
!
! \begin{verbatim}
! >>> from AuthorBooks.Book import Book
! >>> ec=EditingContext()
! >>> books=ec.fetch('Book')
! >>> pprint.pprint([b.getTitle() for b in books])
! ['Gargantua',
! 'Bouge ton pied que je voie la mer',
! 'Le coup du pere Francois',
! "T'assieds pas sur le compte-gouttes"]
! >>> new_book=Book()
! >>> new_book.setTitle('The Great Book')
! >>> ec.insert(new_book)
! >>> books=ec.fetch('Book')
! >>> pprint.pprint([b.getTitle() for b in books])
! ['Gargantua',
! 'Bouge ton pied que je voie la mer',
! 'Le coup du pere Francois',
! "T'assieds pas sur le compte-gouttes",
! 'The Great Book']
! \end{verbatim}
!
! As exposed above, newly inserted objects automatically appear in the result
! set when applicable. Of course, you can still benefit from standard fetch
! techniques, such as qualifiers:
! \begin{verbatim}
! >>> books=ec.fetch('Book', 'title like "*G*"')
! >>> [b.getTitle() for b in books]
! ['Gargantua', 'The Great Book']
! \end{verbatim}
!
! You get the expected result, even if the inserted book is {\em not} saved in
! the database yet.
!
! If you modify your objects, these modifications will always be visible in your
! result set; continuing on the same example:
!
! \begin{verbatim}
! >>> gargantua=ec.fetch('Book', 'title == "Gargantua"')[0]
! >>> gargantua.setTitle('Gargantua et Pantagruel')
! >>> books=ec.fetch('Book', 'title like "*G*"')
! >>> [b.getTitle() for b in books]
! ['Gargantua et Pantagruel', 'The Great Book']
! \end{verbatim}
!
! Your changes to objects are not persistent yet in the database, still, they
! appear as expected in the result set.
!
! Last, the same principles apply to deleted object:
!
! \begin{verbatim}
! >>> gargantua=ec.fetch('Book', 'title == "Gargantua"')[0]
! >>> pprint.pprint([b.getTitle() for b in ec.fetch('Book')])
! ['Bouge ton pied que je voie la mer',
! 'Le coup du pere Francois',
! "T'assieds pas sur le compte-gouttes",
! 'The Great Book']
! >>> [b.getTitle() for b in ec.fetch('Book', 'title like "*G*"')]
! ['The Great Book']
! \end{verbatim}
!
! Objects marked as deleted do not appear in the result set, even if the object
! still exists in the database (it will only be deleted when the
! \class{EditingContext} receives the \method{saveChanges()} message, see~\ref{ec-save-changes}).
\subsection{Fetching raw rows\label{ec-fetch-raw-rows}}
***************
*** 477,481 ****
The very same rule applies to raw fetch as to ``normal'' fetch, in particular,
! everything we saw in the section~\ref{ec-fetch-inserted-deleted-objects} is
still valid. If your \class{EditingContext} contains some newly inserted
objects, you'll them appear; and deleted objects won't appear. For example:
--- 549,553 ----
The very same rule applies to raw fetch as to ``normal'' fetch, in particular,
! everything we saw in the section~\ref{ec-fetch-reflect-changes} is
still valid. If your \class{EditingContext} contains some newly inserted
objects, you'll them appear; and deleted objects won't appear. For example:
***************
*** 592,595 ****
--- 664,672 ----
just specify the root entity, and the object of the right class will be
automatically returned.
+
+ %\subsubsection{Turning objects to raw rows\label{ec-fetch-turn-object-to-raw-row}}
+ %
+ %For the sake of completeness: CustomObject.snapshot() and
+ %CustomObject.snapshot_raw()
\section{Saving Changes\label{ec-save-changes}}
|