DB_DataObject : table alias in joined queries
| From: | arnaud sellenet | Date: | Tue, 22 Aug 2006 13:50:01 +0000 |
| Subject: | DB_DataObject : table alias in joined queries | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-43774@lists.php.net to get a copy of this message | ||
This is a diff between the current release and a version with added table alias for use in joined queries. Anyone interested ?
255a256,261
/**
* The table alias
**/
var $_alias = '';
420c426
< ' FROM ' . ($quoteIdentifiers ? $DB->quoteIdentifier($this->__table) : $this->__table) . " \n" .---
1517c1523,1525' FROM ' . ($quoteIdentifiers ? $DB->quoteIdentifier($this->__table) : $this->__table) . ' '. $this->_alias . " \n" .
< $table = ($quoteIdentifiers ? $DB->quoteIdentifier($this----__table) : $this->__table);
$tablen = $this->_alias ? $this->_alias:$this->__table;
$table = ($quoteIdentifiers ? $DB->quoteIdentifier($tablen) : $tablen);
$tablefrom = ($quoteIdentifiers ? ($DB->quoteIdentifier($this->__table).' '.$DB->quoteIdentifier($this->_alias)) : ($this-__table.' '.$this->_alias));1529c1537
< FROM $table {$t->_join} {$t->_query['condition']}");
---
FROM $tablefrom {$t->_join} {$t->_query['condition']}");
2427c2435
<
---
$tablen = $this->_alias ? $this->_alias : $this->__table;2429,2430c2437,2438
< ? ( $DB->quoteIdentifier($this->__table) . '.' . $DB->quoteIdentifier($k) )
< : "{$this->__table}.{$k}";
---
? ( $DB->quoteIdentifier($tablen) . '.' . $DB-quoteIdentifier($k) )
: "{$tablen}.{$k}";
3156c3164
< $table = $this->__table;---
< ---$table = $this->_alias?$this->_alias:$this->__table;3282c3290,3298
/**
* creates an table alias in the query
* @param string the alias to use
* @return null
**/
function setAlias($alias) {
$this->_alias = $alias;
}