Login | Register
My pages Projects Community openCollabNet

propel
Reply to message

* = Required fields
* Subject
* Body
Attachments
Send reply to
Topic
Author (directly in email)
Please type the letters in the image above.

Original message

Author hlellelid
Full name Hans Lellelid
Date 2006-10-04 07:56:14 PDT
Message Isn't Sven saying that FETCH_INTO will keep memory/resource use to a
minimum? (Unlike current situation where you would have a new object
allocated for each row returned.)

Hans

Alan Pinstein wrote:
> But you still didn't answer my question? What is the benefit or
> appropriate use of FETCH_INTO that otherwise wouldn't work? Why is it
> needed at all?
>
> Alan
>
> On Oct 4, 2006, at 10:48 AM, Sven Tietje wrote:
>
>> Alan Pinstein wrote:
>>
>> hi alan,
>>
>>> Eeeew. FETCH_INTO sounds awful. I cringe at the idea of how
>>> many bugs
>>> this causes with people not understanding references enough and
>>> having FETCH_INTO cause terrible problems. It's 2006, we don't need
>>> to re-use object shells! That is so not OO I don't even know how to
>>> express it.
>>>
>>> FETCH_INTO seems like some odd hack around GC unless I am not seeing
>>> something.
>>>
>>> Why is it needed?
>>
>> Ok... You are not a friend of FETCH_INTO - just mentioned it for
>> reading and
>> as possible option. If you know what it means: use it, where you need.
>>
>> By default propel should create a new instance for each row.
>>
>>> print "Querying for all properties to geocode...";
>>> $c = new Criteria;
>>> $c->add(MlsPrope​rtyPeer::GEOCODE_SCO​RE, 0); // only encode non-scored
>>> items
>>> $allPropsRS = MlsPropertyPeer::doS​electRS($c);
>>> print "Done!\n";
>>
>>> $rowCount = 0;
>>> $propArr = array();
>>> while ($allPropsRS->next()) {
>>> $prop = new MlsProperty;
>>> $prop->hydrate($allPropsRS);
>>> // do stuff
>>> $rowCount++;
>>> }
>>
>> Yes, of course it works, but i`m a friend of comfort :D Having a
>> resultset
>> and option to set is nice :D
>>
>> $rs = MlsPropertyPeer::doSelect($c);
>> // now just wanna read with some special calculation functions
>> $rs->setMode(Pro​pel::ONE_OBJECT /*FETCH_INTO*/);
>>
>> foreach ($rs as $row) {
>> //do stuff
>> }
>>
>> Of course, the iterator can work internally the way you mentioned above.
>>
>> Was just an idea to discuss. What do you think of using FETCH_CLASS?
>>
>> Alan, i am not against your hydrate-method - just wanna discuss the
>> implementation of pdo-features.
>>
>> Greets sven
>>
>> --------------------​--------------------​--------------------​---------
>> To unsubscribe, e-mail: dev-unsubscribe@prop​el.tigris.org
>> For additional commands, e-mail: dev-help at propel dot tigris dot org
>>
>
> --------------------​--------------------​--------------------​---------
> To unsubscribe, e-mail: dev-unsubscribe@prop​el.tigris.org
> For additional commands, e-mail: dev-help at propel dot tigris dot org
>