Skip to content

Commit

Permalink
- Added another test case to verify issue #11784 (in() expression quotes
Browse files Browse the repository at this point in the history
  sub-selects incorrectly for MySQL handler) is fixed.
# Tests run with PHP 5.2.8 against SQLite memory and MySQL.


git-svn-id: http://svn.ez.no/svn/ezcomponents/trunk/Database@10233 bc0e7bdc-f0fc-0310-8ff6-f601c06e1256
  • Loading branch information
ts committed May 8, 2009
1 parent 6275aad commit 8aa5234
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/sqlabstraction/query_subselect_test.php
Expand Up @@ -214,6 +214,28 @@ public function testSubselectWithDelete()
$this->assertEquals( "DELETE FROM quiz WHERE question IN ( SELECT id FROM question WHERE quiz = :ezcValue1 )", $q->getQuery() );
}

// Verifies issue #11784 is fixed. Code taken from there.
public function testSubselectNotQuotedInInExpr()
{
$db = ezcDbInstance::get();
$q = $db->createSelectQuery();
$q->select( 'somecol' )->from( 'quiz' );

$qQuestions = $q->subSelect();
$qQuestions->select( 'id' )->from( 'question' )->where(
$qQuestions->expr->eq( 'quiz', $qQuestions->bindValue( 1 ) )
);

$q->where(
$q->expr->in( 'question', $qQuestions )
);

$this->assertEquals(
'SELECT somecol FROM quiz WHERE question IN ( SELECT id FROM question WHERE quiz = :ezcValue1 )',
$q->getQuery()
);
}


public static function suite()
{
Expand Down

0 comments on commit 8aa5234

Please sign in to comment.