PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB_DataObject » Bug #3556

fetch error message in DB_DataObject

Details

Submitted2005-02-22 17:15 UTC
Fromjrocketz300 at yahoo dot com
StatusBogus
PackageDB_DataObject
PHP Version4.3.10
OSMAC OS X
Roadmaps(Not assigned)

Comments

[2005-02-22 17:15 UTC] jrocketz300 at yahoo dot com

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

[2005-02-24 09:34 UTC] jrocketz300 at yahoo dot com

Updated error message:

demodao: __find:
demodao: CONNECT: NEW CONNECTION
demodao: CONNECT: mysql://test:test@localhost:3306/test 9acb1902346846caffdeca080167512f
demodao: CONNECT: a:1:{s:32:"9acb1902346846caffdeca080167512f";O:8:"db_mysql":8:{s:10:"autocommit";b:1;s:10:"connection";b:1;s:8:"dbsyntax";s:5:"mysql";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";s:4:"3306";s:6:"socket";b:0;s:8:"database";s:4:"test";}s:8:"features";a:7:{s:5:"limit";s:5:"alter";s:8:"new_link";s:5:"4.2.0";s:7:"numrows";b:1;s:8:"pconnect";b:1;s:7:"prepare";b:0;s:3:"ssl";b:0;s:12:"transactions";b:1;}s:9:"fetchmode";i:1;s:22:"fetchmode_object_class";s:8:"stdClass";s:7:"options";a:8:{s:16:"result_buffering";i:500;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";}}}
demodao: CONNECT: USING CACHED CONNECTION
demodao: CONNECT: USING CACHED CONNECTION
demodao: QUERY: SELECT * FROM demo
demodao: Query Error: [db_error: message="DB Error: no database selected" code=-14 mode=return level=notice prefix="" info="SELECT * FROM demo [nativecode=**]"]
demodao: __find: CHECK autofetchd
demodao: __find: DONE
Found 0 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