xmlPath = str_replace('CubridSubqueryTest.php', '', str_replace('\\', '/', __FILE__)) . $this->xmlPath; } function _test($xml_file, $argsString, $expected){ $this->_testQuery($xml_file, $argsString, $expected, 'getSelectSql'); } function testSelectUncorrelated1(){ $xml_file = $this->xmlPath . "select_uncorrelated1.xml"; echo $xml_file; $argsString = '$args->user_id = 4; '; $expected = 'select "column_a" as "value_a" , (select max("column_b") as "count" from "xe_table_b" as "table_b" ) as "value_b" from "xe_table_a" as "table_a" where "column_a" = 4'; $this->_test($xml_file, $argsString, $expected); } function testSelectUncorrelated2(){ $xml_file = $this->xmlPath . "select_uncorrelated2.xml"; echo $xml_file; $argsString = '$args->user_id = 4; $args->user_name = 7; '; $expected = 'SELECT "column_a" as "value_a" , "column_b" as "value_b" , "column_c" as "value_c" , (SELECT max("column_b") as "count" FROM "xe_table_b" as "table_b" WHERE "column_ab" = 7) as "value_b" FROM "xe_table_a" as "table_a" WHERE "column_a" = 4'; $this->_test($xml_file, $argsString, $expected); } function testFromUncorrelated(){ $xml_file = $this->xmlPath . "from_uncorrelated1.xml"; echo $xml_file; $argsString = '$args->user_id = 4; $args->user_name = 7; '; $expected = 'select max("documentcountbymember"."count") as "maxcount" from ( select "member_srl" as "member_srl" , count(*) as "count" from "xe_documents" as "documents" group by "member_srl" ) as "documentcountbymember"'; $this->_test($xml_file, $argsString, $expected); } function testWhereUncorrelated(){ $xml_file = $this->xmlPath . "where_uncorrelated1.xml"; echo $xml_file; $argsString = ''; $expected = 'select * from "xe_member" as "member" where "regdate" = (select max("regdate") as "maxregdate" from "xe_documents" as "documents")'; $this->_test($xml_file, $argsString, $expected); } } ?>