Problem with PDO statements (and similar traversable objects) is that they are very limited at iterating. No count support out of the box, not possible to be 'rewinded' (so they just can be used once in the template) and they are very dependent on their type of data.
I do think that support for them should be removed from phptal but include in the manual an appendix with 'good practices' and example code on how to implement an iterator for such objects. PS: I'll try to update the unit tests to cover the new repeat features over the next weekend. Ivan On Feb 6, 2008 1:51 AM, Kornel Lesi��ski <[EMAIL PROTECTED]> wrote: > > On 03.02.2008, at 22:58, Iván -DrSlump- Montes wrote: > > > Following with the repeat discussion I've refactored the repeat > > controller to add some Zope features missing from it. I've also added > > support for PHP internal objects implementing Traversable (like PDO) > > by traversing the object at instantiation time and storing all the > > results in a temporary array. I think this is a good trade-off, if > > someone has special needs which are not suited by this approach he/she > > can wrap the traversable object with a specialized iterator. > > > It's very good! I've committed it to SVN, with just a little > workaround ― I've discovered that DOMNodeList is traversable, but not > Traversable. > > I don't mind extra overhead (it's negligible indeed), but I'm > concerned about buffering of PDOStatement results. It would be nice to > provide specialised iterator out of the box ― one that "streams" one > row at a time and lazily fetches rest only if /last is used (or maybe > it shouldn't bother at all? One can use fetchAll in a template to > iterate a real array). > > I was planning to remove unnecessary buffering from PHPTAL to allow > generation of arbitrarily large documents without hitting memory > limit. For this to be useful, unbuffered PDO support is needed. > > -- > > regards, Kornel > > > > _______________________________________________ > PHPTAL mailing list > PHPTAL@lists.motion-twin.com > http://lists.motion-twin.com/mailman/listinfo/phptal >
_______________________________________________ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal