Project

General

Profile

Actions

Bug #19999

closed

table name are not mapped in the value part of a query and in inner join

Added by Michael Miousse about 15 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Should have
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2009-02-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

when having a query like this:

SELECT table1.* FROM table1 INNER JOIN table2 ON table1.uid = table2.fk_table1 WHERE table1.price < table2.cost

INNER JOIN and all other join(i suppose) are not supported for the mapping

table2 is not mapped in the where

ill make a ptach for this in a few days
(issue imported from #M10411)


Files

bug_10411_rev_4432.patch (2.83 KB) bug_10411_rev_4432.patch Administrator Admin, 2009-02-13 14:42
bug_10411_v2.diff (9.3 KB) bug_10411_v2.diff Administrator Admin, 2009-10-13 17:02
xp_10411_dbal.diff (3.92 KB) xp_10411_dbal.diff Administrator Admin, 2009-10-19 08:01
xp_10411_core.diff (3.38 KB) xp_10411_core.diff Administrator Admin, 2009-10-19 08:01
10411_dbal_v3.diff (4.55 KB) 10411_dbal_v3.diff Administrator Admin, 2009-10-27 18:52
Actions #1

Updated by Xavier Perseguers over 14 years ago

Please give some code to reproduce this issue.

Actions #2

Updated by Michael Miousse over 14 years ago

the part from the where as been resolved in an other bug.

But the par for the join is still valid.

since that i pushed my investigation a bite further . joins are not mapped at all

i will have to remake my patch to suppresse the part of the where and to add and modify the mapping part for the join to fit with multiple joins

for the code to reproduce try this query and map all tables in the query and you will see that none of them are mapped:

$res= $GLOBALS['TYPO3_DB']->exec_SELECTquery('*','tt_news_cat inner join tt_news_cat_mm on tt_news_cat.uid = tt_news_cat_mm.uid_foreign inner join tt_news on tt_news.uid = tt_news_cat_mm.uid_local','1=1');

ps. sorry for the 2 bugs in one, i should have created 2 seperated bugs for this on

Actions #3

Updated by Michael Miousse over 14 years ago

Hi xavier

i have recreated my patch to only patch the mapping error of joins and i modified the parser in order to parse multiple joins in a query and inner joins.

could you read it and test it.
thx

Actions #4

Updated by Xavier Perseguers over 14 years ago

Hi Michael,

I started reviewing the changes. Thanks for the new patch. I'm currently working on it but a few comments:

- You copied 2 methods from TYPO3's core (in t3lib_sqlparser): methods parseFromTables and compileFromTables. There's a problem as I don't want to start fixing bugs in Core by copying faulty methods into DBAL, they have to be fixed there (I know that it's trickier to get code committed there). In addition by looking into what changed in method parseFromTables, you miss a patch I sent recently to allow aliasing on joined tables (#12071).

- [minor] CGL is not always respected (seems that it's related to code you copied though)

I'll prepare two patches, one for DBAL, the other for Core and will start again reviewing stuff with them.

Actions #5

Updated by Xavier Perseguers over 14 years ago

Example of renaming configuration for query given by Michael Miousse with message from 13.10.2009 14:10:

SQL:
------------------------------------------
RENAME TABLE 'tt_news' TO 'XP_tt_news';
ALTER TABLE `XP_tt_news` CHANGE `uid` `XP_uid` INT NOT NULL AUTO_INCREMENT

RENAME TABLE 'tt_news_cat' TO 'XP_tt_news_cat';
ALTER TABLE `XP_tt_news_cat` CHANGE `uid` `XP_uid` INT NOT NULL AUTO_INCREMENT

RENAME TABLE 'tt_news_cat_mm' TO 'XP_tt_news_cat_mm';
ALTER TABLE `XP_tt_news_cat_mm` CHANGE `uid_local` `XP_uid_local` INT UNSIGNED NOT NULL DEFAULT '0',
CHANGE `uid_foreign` `XP_uid_foreign` INT UNSIGNED NOT NULL DEFAULT '0'

localconf.php:
------------------------------------------
$TYPO3_CONF_VARS['EXTCONF']['dbal']['mapping'] = array(
'tt_news' => array(
'mapTableName' => 'XP_tt_news',
'mapFieldNames' => array(
'uid' => 'XP_uid',
),
),
'tt_news_cat' => array(
'mapTableName' => 'XP_tt_news_cat',
'mapFieldNames' => array(
'uid' => 'XP_uid',
),
),
'tt_news_cat_mm' => array(
'mapTableName' => 'XP_tt_news_cat_mm',
'mapFieldNames' => array(
'uid_local' => 'XP_uid_local',
'uid_foreign' => 'XP_uid_foreign',
),
),
);

Actions #6

Updated by Michael Miousse over 14 years ago

Thx Xavier,

i will try to remember your comment for next patches

I'm happy of the dbal advancement

Actions #7

Updated by Xavier Perseguers over 14 years ago

Patches are deprecated in favor of bug #12440.

Actions

Also available in: Atom PDF