mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-13 07:22:13 +09:00
Fix for Sqlite - "Transaction already started" PDOException. Added unit tests for delete and update Sqlite syntax.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9651 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
ce6496e247
commit
2160ca2833
8 changed files with 108 additions and 3 deletions
18
test-phpUnit/db/xml_query/sqlite/SqliteDeleteTest.php
Normal file
18
test-phpUnit/db/xml_query/sqlite/SqliteDeleteTest.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
require(_XE_PATH_ . 'test-phpUnit/config/config.inc.php');
|
||||
|
||||
class SqliteDeleteTest extends SqliteTest {
|
||||
|
||||
function _test($xml_file, $argsString, $expected, $columnList = null){
|
||||
$this->_testQuery($xml_file, $argsString, $expected, 'getDeleteSql', $columnList);
|
||||
}
|
||||
|
||||
function testDeleteIsGeneratedWithoutAlias(){
|
||||
$xml_file = _TEST_PATH_ . "db/xml_query/sqlite/data/module.deleteModuleConfig.xml";
|
||||
$argsString = '$args->module = "comment"; $args->site_srl = 0; ';
|
||||
$expected = 'delete from "xe_module_config"
|
||||
where "module" = \'comment\' and "site_srl" = 0';
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
|
||||
}
|
||||
22
test-phpUnit/db/xml_query/sqlite/SqliteUpdateTest.php
Normal file
22
test-phpUnit/db/xml_query/sqlite/SqliteUpdateTest.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
require(_XE_PATH_ . 'test-phpUnit/config/config.inc.php');
|
||||
|
||||
class SqliteDeleteTest extends SqliteTest {
|
||||
|
||||
function _test($xml_file, $argsString, $expected, $columnList = null){
|
||||
$this->_testQuery($xml_file, $argsString, $expected, 'getUpdateSql', $columnList);
|
||||
}
|
||||
|
||||
function testUpdateIsGeneratedWithoutAlias(){
|
||||
$xml_file = _TEST_PATH_ . "db/xml_query/sqlite/data/member.updateLastLogin.xml";
|
||||
$argsString = '$args->member_srl = 4;
|
||||
$args->last_login = \'20111014184010\';
|
||||
';
|
||||
$expected = 'UPDATE "xe_member"
|
||||
SET "member_srl" = 4
|
||||
, "last_login" = \'20111014184010\'
|
||||
WHERE "member_srl" = 4';
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<query id="updateLastLogin" action="update">
|
||||
<tables>
|
||||
<table name="member" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="member_srl" var="member_srl" filter="number" notnull="notnull" />
|
||||
<column name="last_login" var="last_login" notnull="notnull" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="member_srl" var="member_srl" notnull="notnull" filter="number" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<query id="deleteModuleConfig" action="delete">
|
||||
<tables>
|
||||
<table name="module_config" />
|
||||
</tables>
|
||||
<conditions>
|
||||
<condition operation="equal" column="module" var="module" notnull="notnull" />
|
||||
<condition operation="equal" column="site_srl" var="site_srl" notnull="notnull" pipe="and" />
|
||||
</conditions>
|
||||
</query>
|
||||
Loading…
Add table
Add a link
Reference in a new issue