mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
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:
parent
2160ca2833
commit
7996fa8bf6
2 changed files with 28 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue