Login | Register
My pages Projects Community openCollabNet

Discussions > dev > Re: [propel-dev] PropelResultset Iterator

propel
Discussion topic

Back to topic list

Re: [propel-dev] PropelResultset Iterator

Reply

Author Sven Tietje <mail at sven-tietje dot de>
Full name Sven Tietje <mail at sven-tietje dot de>
Date 2006-10-04 12:26:37 PDT
Message Alan Pinstein schrieb:
> Yeah, I don't get it either.
>
> Right now, if you use XXXPeer::doSelect() you get an array with all
> objects populated. If you plan on using *all* of the objects in the
> result set, then it doesn't improve performance to hydrate them
> on-demand; it just changes WHERE the cycles happen, but this doesn't
> matter, because the overall performance won't change..
yes, it just one iteration over the resultset, that you do later on -
thats true! you are absolutely right. sometimes, you have to iterator
twice or three times over one resultset (different places of output,
logical iterator). creating them on the first iteration will save one
foreach - don`t laugh!!! :-)

somestimes, you iterator over a resultset and set values. later on in
your application, you iterate again over the resultset and want to do
something and to save your objects. a caching is need to make compatible
to older versions:

$rs = XXXXPeer::doSelect();

$rs[0]->setName('test'); // object#1
$rs[1] //object#2
... your application....

$rs[0]->getName(); // object#1
$rs[0]->setFirst​Name('test2'); should always work on the same object
instance.

but sometimes, you habe to iterate once - then caching should / can be
disabled:
$rs = XXXXPeer::doSelect(Criteria, Propel::NO_CACHING);
$rs[0] // object #1
later on again would result in:
$rs[0] // object #2 ()

i just want to have one resultset having the functions of the actual
array propel gives to me, but also the possibilty to do the "real
iterate way" to save memory. for the last variant my idea was to use
FETCH_INTO, but alan convineced me: "the only overhead is __construct"
(when you real can call it overhead :-))

« Previous message in topic | 22 of 26 | Next message in topic »

Messages

Show all messages in topic

                 Re: [propel-dev] PropelResultset Iterator Alan Pinstein <apinstein at mac dot com> Alan Pinstein <apinstein at mac dot com> 2006-10-04 08:13:23 PDT
Page: of 2 « Previous | Next »
Messages per page: