Strange goings on with DB_DataObject
| From: | Barry Steele | Date: | Wed, 04 Jun 2003 08:05:56 +0000 |
| Subject: | Strange goings on with DB_DataObject | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5772@lists.php.net to get a copy of this message | ||
Hi all,
I recently build an application on my server and had it working well.
Today I moved it onto another machine and now I am getting some really
strange behaviour. I've listed the output below.
Essentially I do the following
$user = new DataObject_authuser;
$user->uname = $vaiable;
$user->find();
$user->fetch() ... etc
but for some reason the query generated has no where clause to return
only the user asked for.
Code looks like :
require_once('DataObjects/Authuser.php');
require_once('DataObjects/Authteam.php') ;
$username = $_COOKIE['USERNAME'];
print_r($_COOKIE);
print("User = $username <br>");
$user = new DataObject_Authuser;
$user->uname=$username;
$user->debugLevel(5);
print_r($user);
$found = $user->find();
if ($found == 0)
{
die("User not found in database - Why?");
}
$user->fetch();
print("<hr>");
print_r($user);
Output looks like -
Array ( [USERNAME] => fred [PASSWORD] => *******)
User = fred
dataobject_authuser Object (
[__table] => authuser
[id] =>
[uname] => fred
[passwd] => [team] =>
[level] => [status] =>
[lastlogin] =>
[logincount] =>
[_DB_DataObject_version] => 1.0
[N] => 0 [_database_dsn] =>
[_database_dsn_md5] =>
[_database] =>
[_condition] =>
[_group_by] =>
[_order_by] =>
[_limit] =>
[_data_select] => *
[_DB_resultid] =>
[_link_loaded] =>
[_join] =>
[_lastError] =>
)
__find
CONNECT USING CACHED CONNECTION
sql QUERYSELECT * FROM authuser
query DONE QUERY
RESULT
O:9:"db_result":9:{s:3:"dbh";O:8:"db_mysql":26:{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:2:{i:24;i:7;i:27;i:7;}s:19:"transaction_opcount";i:0;s:10:"autocommit";b:1;s:9:"fetchmode";i:1;s:3:"_db";s:4:"slsa";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:15:{i:1004;i:-15;i:1005;i:-15;i:1006;i:-15;i:1007;i:-5;i:1008;i:-17;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;}s:4:"type";N;s:16:"prepared_queries";N;s:15:"prepare_maxstmt";i:0;s:10:"last_query";s:26:"SELECT
* FROM authuser
";s:22:"fetchmode_object_class";s:8:"stdClass";s:7:"options";a:5:{s:10:"persistent";b:0;s:8:"optimize";s:11:"performance";s:5:"debug";i:0;s:14:"seqname_format";s:6:"%s_seq";s:8:"autofree";b:0;}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:"slsa";s:8:"password";s:7:"ab5.amp";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:"slsa";}}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";}
__find CHECK autofetchd
__find DONE
FETCH
a:8:{s:2:"id";s:1:"1";s:5:"uname";s:2:"sa";s:6:"passwd";s:32:"21232f297a57a5a743894a0e4a801fc3";s:4:"team";s:5:"Admin";s:5:"level";s:1:"1";s:6:"status";s:6:"active";s:9:"lastlogin";s:19:"2003-05-26
18:02:23";s:10:"logincount";s:2:"38";}
fetchrow LINE id = 1
fetchrow LINE uname = sa
fetchrow LINE passwd = 21232f297a57a5a743894a0e4a801fc3
fetchrow LINE team = Admin
fetchrow LINE level = 1
fetchrow LINE status = active
fetchrow LINE lastlogin = 2003-05-26 18:02:23
fetchrow LINE logincount = 38
fetchrow authuser DONE
________________________________________________________________________
dataobject_authuser Object (
[__table] =>
authuser [id] => 1
[uname] => sa
[passwd] => 21232f297a57a5a743894a0e4a801fc3
[team] => Admin
[level] => 1
[status] => active
[lastlogin] => 2003-05-26 18:02:23
[logincount] => 38
[_DB_DataObject_version] => 1.0
[N] => 7
[_database_dsn] =>
[_database_dsn_md5] => 4b8c84d0911f7afc51eec639a280bd4b
[_database] => slsa
[_condition] =>
[_group_by] =>
[_order_by] =>
[_limit] =>
[_data_select] => *
[_DB_resultid] => 1
[_link_loaded] =>
[_join] =>
[_lastError] =>
)
I'm trying to get the versions of DB and DB_DataObject on the new
machine.
On my box this works like one would expect it to.
any clues?
Is there some config needed on the new box?
--
Barry Steele <barry@hpfm.biz>
hpfm