Bug #19999 » bug_10411_rev_4432.patch
https://svn.typo3.org/TYPO3v4/Core/trunk/typo3/sysext/dbal/class.ux_t3lib_db.php | ||
---|---|---|
$tables = $this->SQLparser->parseFromTables($from_table);
|
||
$defaultTable = $tables[0]['table'];
|
||
foreach($tables as $k => $v) {
|
||
// Mapping JOINS
|
||
if(is_array($v['JOIN'])){
|
||
// Mapping withTable of the join
|
||
if ($this->mapping[$v['JOIN']['withTable']]['mapTableName']) {
|
||
$tables[$k]['JOIN']['withTable'] = $this->mapping[$v['JOIN']['withTable']]['mapTableName'];
|
||
}
|
||
//Mapping ON parts of the JOIN
|
||
if(is_array($v['JOIN']['ON'])){
|
||
foreach($v['JOIN']['ON'] as $onParts){
|
||
if(isset($this->mapping[$onParts['table']]['mapFieldNames'][$onParts['field']])){
|
||
$onParts['field']=$this->mapping[$onParts['table']]['mapFieldNames'][$onParts['field']];
|
||
}
|
||
|
||
if (isset($this->mapping[$onParts['table']]['mapTableName'])) {
|
||
$onParts['table'] = $this->mapping[$onParts['table']]['mapTableName'];
|
||
}
|
||
$onPartsArray[] =$onParts;
|
||
}
|
||
$tables[$k]['JOIN']['ON']=$onPartsArray;
|
||
}
|
||
|
||
}
|
||
//Mapping plain table
|
||
if ($this->mapping[$v['table']]['mapTableName']) {
|
||
$tables[$k]['table'] = $this->mapping[$v['table']]['mapTableName'];
|
||
}
|
||
... | ... | |
// do we have a field name in the value?
|
||
// this is a very simplistic check, beware
|
||
if(is_array($this->mapping[$t]['mapFieldNames']) && (!is_numeric($sqlPartArray[$k]['value'][0]) && !isset($sqlPartArray[$k]['value'][1]))) {
|
||
if( (!is_numeric($sqlPartArray[$k]['value'][0]) && !isset($sqlPartArray[$k]['value'][1]))) {
|
||
$fieldArray = explode('.', $sqlPartArray[$k]['value'][0]);
|
||
if(count($fieldArray)==1 && isset($this->mapping[$t]['mapFieldNames'][$fieldArray[0]])) {
|
||
$sqlPartArray[$k]['value'][0] = $this->mapping[$t]['mapFieldNames'][$fieldArray[0]];
|
||
} elseif(count($fieldArray)==2 && isset($this->mapping[$t]['mapFieldNames'][$fieldArray[1]])) {
|
||
$sqlPartArray[$k]['value'][0] = $fieldArray[0].'.'.$this->mapping[$t]['mapFieldNames'][$fieldArray[1]];
|
||
} elseif(count($fieldArray)==2 && isset($this->mapping[$fieldArray[0]]['mapFieldNames'][$fieldArray[1]])) {
|
||
if(isset($this->mapping[$fieldArray[0]]['mapTableName'])){
|
||
$mappedTable=$this->mapping[$fieldArray[0]]['mapTableName'];
|
||
}
|
||
else{
|
||
$mappedTable=$fieldArray[0];
|
||
}
|
||
$sqlPartArray[$k]['value'][0] = $mappedTable.'.'.$this->mapping[$fieldArray[0]]['mapFieldNames'][$fieldArray[1]];
|
||
}
|
||
}
|
||
|
||
// Map table?
|
||
if ($sqlPartArray[$k]['table'] && $this->mapping[$sqlPartArray[$k]['table']]['mapTableName']) {
|
||
$sqlPartArray[$k]['table'] = $this->mapping[$sqlPartArray[$k]['table']]['mapTableName'];
|