Project

General

Profile

Bug #19999 » 10411_dbal_v3.diff

Administrator Admin, 2009-10-27 18:52

View differences:

class.ux_t3lib_db.php (working copy)
$from_table[$k]['as'] = $this->quoteName($from_table[$k]['as']);
}
if (is_array($v['JOIN'])) {
$from_table[$k]['JOIN']['withTable'] = $this->quoteName($from_table[$k]['JOIN']['withTable']);
$from_table[$k]['JOIN']['as'] = ($from_table[$k]['JOIN']['as']) ? $this->quoteName($from_table[$k]['JOIN']['as']) : '';
$from_table[$k]['JOIN']['ON'][0]['table'] = ($from_table[$k]['JOIN']['ON'][0]['table']) ? $this->quoteName($from_table[$k]['JOIN']['ON'][0]['table']) : '';
$from_table[$k]['JOIN']['ON'][0]['field'] = $this->quoteName($from_table[$k]['JOIN']['ON'][0]['field']);
$from_table[$k]['JOIN']['ON'][1]['table'] = ($from_table[$k]['JOIN']['ON'][1]['table']) ? $this->quoteName($from_table[$k]['JOIN']['ON'][1]['table']) : '';
$from_table[$k]['JOIN']['ON'][1]['field'] = $this->quoteName($from_table[$k]['JOIN']['ON'][1]['field']);
foreach ($v['JOIN'] as $joinCnt => $join) {
$from_table[$k]['JOIN'][$joinCnt]['withTable'] = $this->quoteName($join['withTable']);
$from_table[$k]['JOIN'][$joinCnt]['as'] = ($join['as']) ? $this->quoteName($join['as']) : '';
$from_table[$k]['JOIN'][$joinCnt]['ON'][0]['table'] = ($join['ON'][0]['table']) ? $this->quoteName($join['ON'][0]['table']) : '';
$from_table[$k]['JOIN'][$joinCnt]['ON'][0]['field'] = $this->quoteName($join['ON'][0]['field']);
$from_table[$k]['JOIN'][$joinCnt]['ON'][1]['table'] = ($join['ON'][1]['table']) ? $this->quoteName($join['ON'][1]['table']) : '';
$from_table[$k]['JOIN'][$joinCnt]['ON'][1]['field'] = $this->quoteName($join['ON'][1]['field']);
}
}
}
return $this->SQLparser->compileFromTables($from_table);
......
if (!is_numeric($where_clause[$k]['field'])) {
$where_clause[$k]['field'] = $this->quoteName($where_clause[$k]['field']);
}
if (isset($where_clause[$k]['calc_table'])) {
if ($where_clause[$k]['calc_table'] != '') {
$where_clause[$k]['calc_table'] = $this->quoteName($where_clause[$k]['calc_table']);
}
if ($where_clause[$k]['calc_field'] != '') {
$where_clause[$k]['calc_field'] = $this->quoteName($where_clause[$k]['calc_field']);
}
}
}
if ($where_clause[$k]['comparator']) {
// Detecting value type; list or plain:
......
if ($fieldMappingOnly) {
if (is_array($this->mapping[$tableCfg['table']]['mapFieldNames'])) {
$this->cache_mappingFromTableList[$key] = $tables;
}
} elseif (is_array($tableCfg['JOIN'])) {
foreach ($tableCfg['JOIN'] as $join) {
if (is_array($this->mapping[$join['withTable']]['mapFieldNames'])) {
$this->cache_mappingFromTableList[$key] = $tables;
break;
}
}
}
} else {
if (is_array($this->mapping[$tableCfg['table']])) {
$this->cache_mappingFromTableList[$key] = $tables;
}
} elseif (is_array($tableCfg['JOIN'])) {
foreach ($tableCfg['JOIN'] as $join) {
if (is_array($this->mapping[$join['withTable']])) {
$this->cache_mappingFromTableList[$key] = $tables;
break;
}
}
}
}
}
}
......
$tables = $this->SQLparser->parseFromTables($from_table);
$defaultTable = $tables[0]['table'];
foreach ($tables as $k => $v) {
// Mapping JOINS
if (is_array($v['JOIN'])) {
foreach($v['JOIN'] as $joinCnt => $join) {
// Mapping withTable of the JOIN
if ($this->mapping[$join['withTable']]['mapTableName']) {
$tables[$k]['JOIN'][$joinCnt]['withTable'] = $this->mapping[$join['withTable']]['mapTableName'];
}
$onPartsArray = array();
// Mapping ON parts of the JOIN
if (is_array($join['ON'])) {
foreach ($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'][$joinCnt]['ON'] = $onPartsArray;
}
}
}
if ($this->mapping[$v['table']]['mapTableName']) {
$tables[$k]['table'] = $this->mapping[$v['table']]['mapTableName'];
}
(5-5/5)