ZF-2695: Select with Array broken with new implementation

Issue Type: Bug Created: 2008-02-20T14:44:48.000+0000 Last Updated: 2008-03-21T17:28:35.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Thomas Weidner (thomas) Assignee: Simon Mundy (peptolab) Tags: - Zend_Db_Select

Related issues: Attachments:


Using the old array input with only one qualifier the values have to be seperated with "," to fit in an IN statement.

This has worked in incubator but somehow the code has only be integrated partitionaly...

<pre class="highlight">
 $select->where(' IN(?)', array(1, 2, 3));

// Output should be : 
// IN('1','2','3')


Posted by Wil Sinclair (wil) on 2008-02-21T13:33:06.000+0000

Is this really critical enough to hold up the 1.5 release? If not, then we should mark it as a should have.

Posted by Thomas Weidner (thomas) on 2008-02-21T15:14:50.000+0000

Not sure... This is a possible BC problem between 1.0.4 and 1.5.

Better to ask Simon or Bill about possible implications.

Posted by Thomas Weidner (thomas) on 2008-03-09T13:22:08.000+0000

So... I added array handling for values (not for conditions this is another issue).

But there is still a problem as only numbers (ints/floats) are quoted, and strings not. This problem is another one than this... but it is the reason why array values are not working for strings and should also be fixed.

I will keep this issue open until also strings are working for array notation in values.

Reproducable code

<pre class="highlight">
$select = new Zend_Db_Select($database);
       ->where("name IN (?)", array(2, 6));

print "\nIntegerARRAY:".$select;

$select = new Zend_Db_Select($database);
       ->where("name IN (?)", array('2', '6'));

print "\nString ARRAY:".$select;

The first produces name IN (2, 6) But the second produces name IN (, ) but it should be name IN ('2', '6')

Posted by Thomas Weidner (thomas) on 2008-03-11T03:31:58.000+0000

Class will be reworked by Simon... He has a better overview over the complete Db design, not only Zend_Db_Select and will fix this better than me.

Posted by Tomasz Wiktorski (sabistik) on 2008-03-11T04:48:04.000+0000

Hello, After you last commit (8711) i have problem with findDependentRowset() method. When i use it i get error:

<pre class="highlight">Fatal error: Uncaught exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[21000]: 
Cardinality violation: 1241 Operand should contain 1 column(s)' in C:\wamp\www\libs\Zend\Db\Statement\Pdo.php:238 
Stack trace: #0 C:\wamp\www\libs\Zend\Db\Statement.php(283): Zend_Db_Statement_Pdo->_execute(Array) #1 
C:\wamp\www\libs\Zend\Db\Adapter\Abstract.php(406): Zend_Db_Statement->execute(Array) #2 
C:\wamp\www\libs\Zend\Db\Adapter\Pdo\Abstract.php(206): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Table_Select), Array) #3 
C:\wamp\www\libs\Zend\Db\Table\Abstract.php(1185): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Table_Select)) #4 
C:\wamp\www\libs\Zend\Db\Table\Abstract.php(1040): Zend_Db_Table_Abstract->_fetch(Object(Zend_Db_Table_Select)) #5 
C:\wamp\www\libs\Zend\Db\Table\Row\Abstract.php(839): Zend_Db_Table_Abstract->fetchAll(Object(Zend_Db_Table_Select)) #6 
C:\wamp\www\dev\app\controllers\BazaController.php(34): Zend_Db_Table_Row_Abstract->findDependentRowset('Bugs') #7 
C:\wamp\www\libs\Zend\Controller\Action. in C:\wamp\www\libs\Zend\Db\Statement\Pdo.php on line 238

I check it on examples from manual… . Relationshitp: $bugsReportedByUser = $user1234->findDependentRowset('Bugs');

Posted by Simon Mundy (peptolab) on 2008-03-12T08:43:27.000+0000

Resolved in trunk r8783

Posted by Wil Sinclair (wil) on 2008-03-21T17:28:35.000+0000

I'm assuming this was merged to the 1.5 release branch for the 1.5.0 release. Please update JIRA if this is not the case.

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.