[TYPO3-dev] DB query iterator; worth a try?

Christian Kuhn lolli at schwarzbu.ch
Thu Apr 22 02:12:19 CEST 2010


Hey,

Jigal van Hemert wrote:
> I've been experimenting a bit with an iterator for queries (comments 
> removed to save space):
> 
> class databaseIterator implements Iterator {

I'm basically a friend of SPL, especially Iterators and ArrayAccess.

For the db api:
Imho, just adding a core class that supports iterators is not enough 
(and you could do this in an library extension or in an extension 
repository / model layer). Maybe it's time to think of on how we can 
create a better structure in the long run.

My problem:
We added TRUNCATEtable() and insertMultipleRows() to t3lib_db for 4.4, 
subSELECT() with 4.3, all are nice to have. And, thanks to Xavier, dbal 
is on a new level.
But, as Dmitry mentioned in other threads, we're really bloating this 
API. While I'm +1 for those methods, I'm against further arbitrary 
methods that might be neat (like a new more sophisticated delete method 
that that supports joins), because they are a) more or less bound to 
mysql and b) they make t3lib_db in its current incarnation even more ugly.

Here are some needs for a future solution. This is a brainstorming and 
it's mixing up different layers:
- be extensible, eg. with an api to register own handlers for special 
query needs, no need for xclasses
- still fully cross-db compatible
- have a better oo interface supporting eg. iterators
- get a simple and clean api, which is straight to use and easy to 
unterstand
- don't loose performance
- still have build-in goodies like quoting, which proofed to make so 
many extensions and core more secure
- support things like views or stored procedures
- and, as always, be fully backwards compatible

Any ideas on how something like that could be achieved? I know on the 
other hand, if we want real abstraction on model / repository level, it 
would probably be wiser to use extbase for such a task anyway. But that 
doesn't solve basic db needs in our low-level t3lib_db.


Hope that was not to cloudy ...
Christian




More information about the TYPO3-dev mailing list