mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
Issue 2289: Add test case for subquery in mysql
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.3.2@11082 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
4bf0491f55
commit
4859bc8bd9
2 changed files with 33 additions and 16 deletions
|
|
@ -343,21 +343,18 @@ class MysqlSelectTest extends MysqlTest {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue 2213
|
||||
* http://code.google.com/p/xe-core/issues/detail?id=2213
|
||||
*
|
||||
* @author Corina Udrescu (dev@xpressengine.org)
|
||||
*/
|
||||
function testSumInCondition()
|
||||
{
|
||||
$xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/sumInCondition.xml";
|
||||
$argsString = '';
|
||||
$expected = 'select *
|
||||
from `xe_test11` as `a`
|
||||
where `site_srl` = 0
|
||||
and `price` <= `a`.`pa_1`+`a`.`pa_2`';
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
|
||||
}
|
||||
function testFromSubquery()
|
||||
{
|
||||
$xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/from_subquery.xml";
|
||||
$argsString = '
|
||||
';
|
||||
$expected = 'SELECT `A`.`member_srl` as `member_srl`, COUNT(`A`.`cnt`) as `count`
|
||||
FROM (
|
||||
SELECT `member_srl` as `member_srl`, count(*) AS `cnt`
|
||||
FROM `xe_documents` as `documents`
|
||||
GROUP BY `member_srl`
|
||||
) AS `A`';
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
}
|
||||
20
tests/classes/db/db/xml_query/mysql/data/from_subquery.xml
Normal file
20
tests/classes/db/db/xml_query/mysql/data/from_subquery.xml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<query id="getMemberInfo" action="select">
|
||||
<tables>
|
||||
<table query="true" alias="A">
|
||||
<tables>
|
||||
<table name="documents" alias="documents" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="member_srl" alias="member_srl" />
|
||||
<column name="count(*)" alias="cnt" />
|
||||
</columns>
|
||||
<groups>
|
||||
<group column="member_srl" />
|
||||
</groups>
|
||||
</table>
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="A.member_srl" alias="member_srl" />
|
||||
<column name="count(A.cnt)" alias="count" />
|
||||
</columns>
|
||||
</query>
|
||||
Loading…
Add table
Add a link
Reference in a new issue