Fixed Sqlite DELETE and UPDATE syntax errors.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9652 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ucorina 2011-10-14 16:35:43 +00:00
parent 2160ca2833
commit 7996fa8bf6
2 changed files with 28 additions and 1 deletions

View file

@ -595,6 +595,33 @@
return new DBParser('"', '"', $this->prefix);
}
function getUpdateSql($query, $with_values = true, $with_priority = false){
$columnsList = $query->getUpdateString($with_values);
if($columnsList == '') return new Object(-1, "Invalid query");
$tableName = $query->getFirstTableName();
if($tableName == '') return new Object(-1, "Invalid query");
$where = $query->getWhereString($with_values);
if($where != '') $where = ' WHERE ' . $where;
$priority = $with_priority?$query->getPriority():'';
return "UPDATE $priority $tableName SET $columnsList ".$where;
}
function getDeleteSql($query, $with_values = true, $with_priority = false){
$sql = 'DELETE ';
$tables = $query->getTables();
$from = $tables[0]->getName();
$sql .= ' FROM '.$from;
$where = $query->getWhereString($with_values);
if($where != '') $sql .= ' WHERE ' . $where;
return $sql;
}
}
return new DBSqlite3_pdo;

View file

@ -1,7 +1,7 @@
<?php
require(_XE_PATH_ . 'test-phpUnit/config/config.inc.php');
class SqliteDeleteTest extends SqliteTest {
class SqliteUpdateTest extends SqliteTest {
function _test($xml_file, $argsString, $expected, $columnList = null){
$this->_testQuery($xml_file, $argsString, $expected, 'getUpdateSql', $columnList);