ZF-5718: Update the documentation to reflect new behaviour regarding passed array values

Issue Type: Docs: Problem Created: 2009-02-09T06:55:35.000+0000 Last Updated: 2009-12-15T14:17:54.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Mark (lightflowmark) Assignee: Satoru Yoshida (satoruyoshida) Tags: - Zend_Db_Select

Related issues: - ZF-8553



Please update the documentation to reflect new behaviour of where() regarding passed array values. From the code comment:

<pre class="highlight">
     * If a value is passed as the second param, it will be quoted
     * and replaced into the condition wherever a question-mark
     * appears. Array values are quoted and comma-separated.

Suggest alteration: "The second argument to the where() method is optional. It is a value to substitute into the expression. Zend_Db_Select quotes the value and substitutes it for a question-mark ("?") symbol in the expression. Array values are quoted and comma-separated, e.g. for use in IN clauses."

A code sample could be

<pre class="highlight">
// Build this query:
//   SELECT product_id, product_name, price
//   FROM "products"
//   WHERE name IN ('O\'Reilly','McIntosh','Amazon')


$select = $db->select()
                    array('product_id', 'product_name', 'price'))
             ->where('product_name IN ?',$nameArray);

I spent some time writing code to do this myself before I read the where() function comment ...


Posted by old of Satoru Yoshida ( on 2009-02-16T06:59:03.000+0000

Set component and auto reassign

Posted by Satoru Yoshida (satoruyoshida) on 2009-08-26T20:45:17.000+0000

This issue may consist of 3 tasks.

  1. change phpdoc of the where() and other methods that call $this->_adapter->quoteInto..

for example in where() now: @param string $value OPTIONAL A single value to quote into the condition. should be : @param mixed $value OPTIONAL A value to quote into the condition.

  1. change following paragraph in en/module_specs/Zend_Db_Select.xml

         This method accepts only one parameter. If you have an expression into which you
         need to substitute multiple variables, you must format the string manually,
         interpolating variables and performing quoting yourself.
  2. add 1 example in the same xml.

Posted by Satoru Yoshida (satoruyoshida) on 2009-12-05T21:36:26.000+0000

Solved in SVN trunk r19445 and r19446

Have you found an issue?

See the Overview section for more details.


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

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