[TYPO3-core] FYI24 #10003: t3lib_db explainOutput does not work with tablealias

Xavier Perseguers typo3 at perseguers.ch
Wed Mar 3 10:45:48 CET 2010


Hi,

Committed:

- trunk (rev. 7073)
- 4-3 (rev. 7074)

Cheers

On 03/01/10 19:06 , Xavier Perseguers wrote:
> Hi,
>
> I'll commit this patch in 24h if nobody objects.
>
> Cheers
> Xavier
>
> On 10/29/09 15:22 , Dan Osipov wrote:
>> This is an SVN patch request.
>>
>> Type: Bugfix
>>
>> Bugtracker references:
>> http://bugs.typo3.org/view.php?id=10003
>>
>> Branch: 4.2, Trunk
>>
>> Problem:
>>
>> Using table aliases in an SQL having t3lib_db::explainOutput ==1 causes
>> mysql errors as t3lib_db::explain function calles explain the executed
>> query and uses returned tablenames to "SHOW INDEX FROM" it. The problem
>> with this is that col 'table' returned by explain can be an alias from a
>> table and then "SHOW INDEX FROM " returns in "table does not exist"
>> error.
>>
>> code:
>> $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('a.uid,b.uid','be_users
>> a,be_users b','1');
>> produces:
>> caller t3lib_DB::exec_SELECTquery
>> ERROR Table 'DBNAME.b' doesn't exist
>> lastBuiltQuery SELECT a.uid,b.uid
>> FROM be_users a,be_users b
>> WHERE
>> 1
>>
>>
>> Solution:
>> Prior to finding the index of the table, check that the table exists.
>> Thanks to Nabil Saleh for the patch!
>
>


-- 
Xavier Perseguers
http://xavier.perseguers.ch/en


More information about the TYPO3-team-core mailing list