[TYPO3-core] SELECTquery() vs exec_SELECTquery()

Martin Kutschker Martin.Kutschker at n0spam-blackbox.net
Thu Jun 1 14:12:55 CEST 2006


Karsten Dambekalns schrieb:
> Hi again.
> 
> On Friday 26 May 2006 15:41, Stanislas Rolland wrote:
> 
>>Martin Kutschker a écrit :
>>
>>>Why is the former deprecated?
>>
>>I thought it was for compatibility with dbal?
> 
> 
> Here Stanislas is still right. If you look at the source, you'll notice that 
> sql_query() *only* uses the _DEFAULT handler, never anything else.
> 
> This means that one really should use the exec_*() methods, because as soon as 
> someone configures more than one handler, using e.g. SELECTquery() and 
> sql_query() on a table configured for the other handler *will break*. I added 
> an explanation to the source in the DBAL ext.
> 
> So, utlimately -1 for removing the deprecation notice. And although there ae 
> more +1's by now, I'll raise a veto in any case!
> 
> (If this means that some optimized code has to be dumped, then so be it.)

I were not talking abut sql_query()! My question was why SELECTquery is 
deprecated? DBAL or not, exec_SELECTquery should - and does! - only call 
SELECTquery and perform a DB execute function.

No need to urge everyone to exec_SELECTquery. It's IMHO even more stupid as 
some DBs have the idea of prepared statements, which is more in line with 
SELECTquery.

sql_query OTOH is a totally different beast. I agree it's more difficult to 
use, buit unless the DB-API has more power (read more supported SQL 
options: aliases, functions, etc) you'll end up using this function.

Perhaps DBAL could be taught to try and figure out the correct handler for 
a query passed to sql_query.

But again, read the subject again, and rethink your veto.

Masi



More information about the TYPO3-team-core mailing list