Hi.

Tests for subselect in this commit use passing object to 
ezcQuerySelect->in() but corresponding ( and discussed ) changes to 
expression.php not included so I have errors that tell about Object not 
allowed as parameter of in().  Actually I've got SQL like "WHERE section 
IN ( Object )" in  testInnerDistinctSubSelectBindParam().

Kore Nordmann wrote:
> Author: Kore Nordmann
> Date: 2007-05-03 15:34:37 +0200 (Thu, 03 May 2007)
> New Revision: 5022
>
> Log:
> - Implemented #8448   (Select Distinct not supported)
>
> Modified:
>    trunk/Database/ChangeLog
>    trunk/Database/src/sqlabstraction/query_select.php
>    trunk/Database/tests/sqlabstraction/query_select_test.php
>    trunk/Database/tests/sqlabstraction/query_select_test_impl.php
>    trunk/Database/tests/sqlabstraction/query_subselect_test.php
>    trunk/Database/tests/sqlabstraction/query_subselect_test_impl.php
>
>  
> +    public function testInnerDistinctSubSelectBindParam()
> +    {
> +        $name = 'IBM';
> +        $name2 = 'company';
> +        $q = new ezcQuerySelect( ezcDbInstance::get() );
> +
> +        // subselect
> +        $q2 = $q->subSelect();
> +        $q->expr->setValuesQuoting( false );
> +
> +        // bind values
> +        $q2->selectDistinct( 'section' )
> +                ->from( 'query_test' );
> +
> +        $q->selectDistinct( 'company' )
> +            ->from( 'query_test2' )
> +            ->where( $q->expr->in( 'section', $q2 ) );
>   

When I changed $q2 to $q2->getQuery() here I've got an error form MySQL 
"Cardinality violation: 1242 Subquery returns more than 1 row" SQLite 
and PosgreSQL works well though.
So I changed the $q2 query for now and make it return only one row. Now 
this test passed. But I think that something wrong here anyway because 
"SELECT s1 FROM t1 WHERE s1 IN  (SELECT s1 FROM t2);" should be the 
correct SQL for MySQL regardless of how many rows returned in subselect.

Regards,
-- 
Sergiy Alyeksyeyev
Software Developer
[EMAIL PROTECTED] | eZ systems | ez.no

-- 
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to