Bug #3556 [NEW]: fetch error message in DB_DataObject

From: Date: Tue, 22 Feb 2005 17:15:01 +0000
Subject: Bug #3556 [NEW]: fetch error message in DB_DataObject
Groups: php.pear.webmaster 
Request: Send a blank email to pear-webmaster+get-3892@lists.php.net to get a copy of this message
From: jrocketz300 at yahoo dot com Operating system: MAC OS X PHP version: 4.3.10 Package: Bug System Bug Type: Bug Bug description: fetch error message in DB_DataObject Description: ------------ It seems like my object is NULL after I call find(); Here's a code sniplet: function getPeople() { DB_DataObject::debugLevel(5); $personObject = $this->factory('DemoDAO'); // do the select query. $number_of_rows = $personObject->find(); echo 'Found ' . $number_of_rows . ' roles.'; // THIS IS WHERE IT'S FAILING $res= $personObject->getDatabaseResult(); $quickFormSelect->loadDbResult($res,'id','name'); demodao: __find: demodao: CONNECT: USING CACHED CONNECTION demodao: CONNECT: USING CACHED CONNECTION demodao: CONNECT: USING CACHED CONNECTION demodao: QUERY: SELECT * FROM demo demodao: query: QUERY DONE IN 0.00369119644165 seconds demodao: RESULT: O:9:"db_result":9:{s:3:"dbh";O:8:"db_mysql":25:{s:10:"connection";i:0;s:7:"phptype";s:5:"mysql";s:8:"dbsyntax";s:5:"mysql";s:14:"prepare_tokens";a:0:{}s:13:"prepare_types";a:0:{}s:8:"num_rows";a:1:{i:31;i:64;}s:19:"transaction_opcount";i:0;s:10:"autocommit";b:1;s:9:"fetchmode";i:1;s:3:"_db";s:4:"test";s:6:"_debug";b:0;s:19:"_default_error_mode";N;s:22:"_default_error_options";N;s:22:"_default_error_handler";s:0:"";s:12:"_error_class";s:8:"DB_Error";s:16:"_expected_errors";a:0:{}s:8:"features";a:4:{s:7:"prepare";b:0;s:8:"pconnect";b:1;s:12:"transactions";b:1;s:5:"limit";s:5:"alter";}s:13:"errorcode_map";a:17:{i:1004;i:-15;i:1005;i:-15;i:1006;i:-15;i:1007;i:-5;i:1008;i:-17;i:1022;i:-5;i:1046;i:-14;i:1050;i:-5;i:1051;i:-18;i:1054;i:-19;i:1062;i:-5;i:1064;i:-2;i:1100;i:-21;i:1136;i:-22;i:1146;i:-18;i:1048;i:-3;i:1216;i:-3;}s:16:"prepared_queries";N;s:15:"prepare_maxstmt";i:0;s:10:"last_query";s:23:"SELECT * FROM demo ";s:22:"fetchmode_object_class";s:8:"stdClass";s:7:"options";a:7:{s:10:"persistent";b:0;s:3:"ssl";b:0;s:5:"debug";i:0;s:14:"seqname_format";s:6:"%s_seq";s:8:"autofree";b:0;s:11:"portability";i:0;s:8:"optimize";s:11:"performance";}s:3:"dbh";N;s:3:"dsn";a:9:{s:7:"phptype";s:5:"mysql";s:8:"dbsyntax";s:5:"mysql";s:8:"username";s:4:"test";s:8:"password";s:4:"test";s:8:"protocol";s:3:"tcp";s:8:"hostspec";s:9:"localhost";s:4:"port";b:0;s:6:"socket";b:0;s:8:"database";s:4:"test";}}s:6:"result";i:0;s:11:"row_counter";N;s:10:"limit_from";N;s:11:"limit_count";N;s:10:"limit_type";s:5:"alter";s:8:"autofree";b:0;s:9:"fetchmode";i:1;s:22:"fetchmode_object_class";s:8:"stdClass";} demodao: __find: CHECK autofetchd demodao: __find: DONE Found 64 roles. Fatal error: Call to a member function on a non-object in /Users/xxx/Projects/xxxx/lib/persistence/DemoDAO.class.php on line 76 Reproduce code: --------------- function getPeople() { DB_DataObject::debugLevel(5); $personObject = $this->factory('DemoDAO'); // do the select query. $number_of_rows = $personObject->find(); echo 'Found ' . $number_of_rows . ' roles.'; $res= $personObject->getDatabaseResult(); $quickFormSelect->loadDbResult($res,'id','name'); Expected result: ---------------- A list of objects Actual result: -------------- demodao: __find: demodao: CONNECT: USING CACHED CONNECTION demodao: CONNECT: USING CACHED CONNECTION demodao: CONNECT: USING CACHED CONNECTION demodao: QUERY: SELECT * FROM demo demodao: query: QUERY DONE IN 0.00369119644165 seconds demodao: RESULT: O:9:"db_result":9:{s:3:"dbh";O:8:"db_mysql":25:{s:10:"connection";i:0;s:7:"phptype";s:5:"mysql";s:8:"dbsyntax";s:5:"mysql";s:14:"prepare_tokens";a:0:{}s:13:"prepare_types";a:0:{}s:8:"num_rows";a:1:{i:31;i:64;}s:19:"transaction_opcount";i:0;s:10:"autocommit";b:1;s:9:"fetchmode";i:1;s:3:"_db";s:4:"test";s:6:"_debug";b:0;s:19:"_default_error_mode";N;s:22:"_default_error_options";N;s:22:"_default_error_handler";s:0:"";s:12:"_error_class";s:8:"DB_Error";s:16:"_expected_errors";a:0:{}s:8:"features";a:4:{s:7:"prepare";b:0;s:8:"pconnect";b:1;s:12:"transactions";b:1;s:5:"limit";s:5:"alter";}s:13:"errorcode_map";a:17:{i:1004;i:-15;i:1005;i:-15;i:1006;i:-15;i:1007;i:-5;i:1008;i:-17;i:1022;i:-5;i:1046;i:-14;i:1050;i:-5;i:1051;i:-18;i:1054;i:-19;i:1062;i:-5;i:1064;i:-2;i:1100;i:-21;i:1136;i:-22;i:1146;i:-18;i:1048;i:-3;i:1216;i:-3;}s:16:"prepared_queries";N;s:15:"prepare_maxstmt";i:0;s:10:"last_query";s:23:"SELECT * FROM demo ";s:22:"fetchmode_object_class";s:8:"stdClass";s:7:"options";a:7:{s:10:"persistent";b:0;s:3:"ssl";b:0;s:5:"debug";i:0;s:14:"seqname_format";s:6:"%s_seq";s:8:"autofree";b:0;s:11:"portability";i:0;s:8:"optimize";s:11:"performance";}s:3:"dbh";N;s:3:"dsn";a:9:{s:7:"phptype";s:5:"mysql";s:8:"dbsyntax";s:5:"mysql";s:8:"username";s:4:"test";s:8:"password";s:4:"test";s:8:"protocol";s:3:"tcp";s:8:"hostspec";s:9:"localhost";s:4:"port";b:0;s:6:"socket";b:0;s:8:"database";s:4:"test";}}s:6:"result";i:0;s:11:"row_counter";N;s:10:"limit_from";N;s:11:"limit_count";N;s:10:"limit_type";s:5:"alter";s:8:"autofree";b:0;s:9:"fetchmode";i:1;s:22:"fetchmode_object_class";s:8:"stdClass";} demodao: __find: CHECK autofetchd demodao: __find: DONE Found 64 roles. Fatal error: Call to a member function on a non-object in /Users/xxx/Projects/xxxx/lib/persistence/DemoDAO.class.php on line 76 -- Edit bug report at http://pear.php.net/bugs/bug.php?id=3556&edit=1 --

« previous php.pear.webmaster (#3892) next »