Issue 1739: MSSQL Update statements fail when using alias

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10457 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ucorina 2012-03-22 12:40:34 +00:00
parent 0e804c1b52
commit 867af986f4
2 changed files with 38 additions and 11 deletions

View file

@ -403,6 +403,27 @@
return $this->_query($query);
}
function getUpdateSql($query, $with_values = true, $with_priority = false){
$columnsList = $query->getUpdateString($with_values);
if($columnsList == '') return new Object(-1, "Invalid query");
$from = $query->getFromString($with_values);
if($from == '') return new Object(-1, "Invalid query");
$tables = $query->getTables();
$alias_list = '';
foreach($tables as $table)
$alias_list .= $table->getAlias();
join(',', split(' ', $alias_list));
$where = $query->getWhereString($with_values);
if($where != '') $where = ' WHERE ' . $where;
$priority = $with_priority?$query->getPriority():'';
return "UPDATE $priority $alias_list SET $columnsList FROM ".$from.$where;
}
/**
* @brief Handle deleteAct
**/