Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.3

Bug #10890 pgsql -> addMultiple cause Warning "Cannot use a scalar value as an array"
Submitted: 2007-04-29 23:53 UTC
From: noodle Assigned: quipo
Status: Closed Package: MDB_QueryTool (version 1.2.0)
PHP Version: 5.1.2 OS: irrelevant
Roadmaps: (Not assigned)    

 [2007-04-29 23:53 UTC] noodle (Emmanuel Drouet)
Description: ------------ Calling addMultiple to insert datas when no primaryCol defined raise a Warning "Cannot use a scalar value as an array". (tested with pgsql driver, no error with mysql) Test script: --------------- a simple table with two fields : id_group id_right an array : $datas = array ( array (1, 2), array (1, 3), ... ); dataObject : class doGroupRight extends MDB_QueryTool { var $table = TABLE_GROUP_RIGHT; var $sequenceName = TABLE_GROUP_RIGHT; var $primaryCol = null; var $tableSpec = array( array('name' => TABLE_GROUP_RIGHT, 'shortName' => 'groupRight'), ); php code : $doGroupRight = new doGroupRight($_cDb, $doOptions, 2); $doGroupRight->addMultiple($datas); Expected result: ---------------- new datas in table Actual result: -------------- datas inserted but Warning "Cannot use a scalar value as an array" raised PEAR/MDB/QueryTool/Query.php > line 770 $retIds = $this->primaryCol ? array() : true; > line 816 $retIds[] = $res; with my dataobject, ->primaryCol is null, so $retIds = true and not an array. => $retIds[] raise Warning


 [2007-04-30 11:46 UTC] quipo (Lorenzo Alberton)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.