[PHPTAL] PHPTAL_RepeatController and PDOStatement
Kornel Lesiński
kornel at aardvarkmedia.co.uk
Wed Feb 6 01:51:26 CET 2008
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
More information about the PHPTAL
mailing list