[Typo3-dev] pi_exec_query() and joins; bug?

Christopher tombedlam at yahoo.com
Mon Apr 18 18:33:04 CEST 2005


Hello list,

In an extension I'm writing I need to perform a simple inner-join,
something like:


SELECT * FROM table1,table2 WHERE table1.column = table2.column;


This presents no problem when using the base T3 sql functions such as:


exec_SELECTquery('*','table1,table2','table1.column = table2.column');


But since some of the functions in class.tslib_pibase.php (such as the
results browser) rely on the use of pi_exec_query(), I tried to use it
instead; however, it results in an error. The function asks for the
following parameters:


function
pi_exec_query($table,$count=0,$addWhere='',$mm_cat='',$groupBy='',$orderBy='',$query='')


...which seems to mean (according to the source) that my join should looks
something like this:


pi_exec_query('table1,table2',$count=0,$addWhere='AND table1.column =
table2.column');


However, the above query throws the following error:


'NO entry in the $TCA-array for the table
"user_employmentcoordinator_resume,fe_users". This means that the function
enableFields() is called with an invalid table name as argument.'


As far as I can tell, the extension's $TCA is correctly configured; a
pi_exec_query() to either of the tables in question is successful. The
problem seems to be that the function (actually the function it *calls*) is
actually trying to find a table in the $TCA named 'table1,table2'...

I can write a page-browser of my own into the extension, but I wonder if a)
this is a bug that should be reported, b) if there is a better,
API-compliant method for running inner-join queries or c) if this is just a
chair-keyboard interface problem?


-Christopher



		
__________________________________ 
Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 




More information about the TYPO3-dev mailing list