PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject » Bug #3898

$table->count() returns incorrect result

Details

Submitted2005-03-21 13:22 UTC
Fromphp at drn dot org
Assignedalan_k
StatusClosed
PackageDB_DataObject
PHP Version5.0.3
OSSolaris 9
Roadmaps(Not assigned)

Comments

[2005-03-21 13:22 UTC] php at drn dot org

Description:
------------
I recently upgraded to DB_DataObject 1.7.10, and spotted that the ->count() method seems to returning incorrect results.

My code basically just joins 2 tables, and performs a count of the joined tables.

I successively downgraded until I found a working version (1.7.7), which makes me think that the fix for bug# 3783 is probably the cause of this change.

Please can someone investigate.

Thank you.

I am running the following versions:

PEAR 1.3.5
DB 1.7.4
MySQL 4.1.7

Reproduce code:
---------------
$t1 = new DataObjects_Table1;
$t2 = new DataObjects_Table2;

$t1->joinAdd($t2);

print $t1->count();

# My .links file has an entry equivalent to:

[table2]
key_id = table1:key_id

Expected result:
----------------
57

Actual result:
--------------
7

[2005-03-22 08:52 UTC] php at drn dot org

All looks well in your 1.7.11 release. Thanks for sorting this out.

Ben.