|
geert van bommel - 2009-06-11 13:06:18
Hi,
I tested the class with a table of 10000 rows. To count the rows I have to do:
$rowset=$db->tablename();
$total=count($rowset);
I had no result returned. I guess due to a too large rowset.
So I added count to the class.
On row 268:
case 'total':
return new crdb_ext($this,'total');
**** I called it 'total' since 'count' is a php function. ****
and on row 648:
elseif($this->ext_name=='total'):
if(!empty($this->rowset->join_query)):
$full_field_name=$this->rowset->join_obj->join_aliases[$field];
$this->rowset->result_columns=" COUNT($full_field_name) as `$field`";
else:
$this->rowset->result_columns=" COUNT(`$field`) as `$field`";
endif;
return $this->rowset->$field;
Regards,
Geert
Sandeep.C.R - 2009-06-12 09:04:26 - In reply to message 1 from geert van bommel
hi,
Thanks for using the class.
I checked the class with a table with 55000 rows.And it worked.I think you might be using an old version of this class.Can you send me the version of the file you are using? or can you with the latest version of this class and let me know the resutls?
Your method of finding the count is more efficient.But I just wanted to make it as simple as possible.
regards,
Sandeep.
geert van bommel - 2009-06-15 08:24:53 - In reply to message 2 from Sandeep.C.R
Hi,
I made sure I'm using the last version and I have the same result. The size of the table doesn't matter, but the amount of records returned does, I think.
If the table has 55000 rows, but the query returns 10000 rows then count($rowset) doesn't work anymore. Even stranger, the browser serves the script as a download.
Your method is indeed easier. Adding my method doesn't exclude users from choosing :-) It's a bit like doing mysql_query('select * from...') and then using mysql_num_rows to find the count, while 'select count(id) from ' uses less resources.
Other than that, happy using your class!
Regards,
Geert
Sandeep.C.R - 2009-06-16 12:00:14 - In reply to message 3 from geert van bommel
hi,
i have modified the class not to store the result in array.Because you told the script is serverd as download, it should be running out of memory.So it shouldbe fixed now.
Regards,
geert van bommel - 2009-06-29 08:08:28 - In reply to message 4 from Sandeep.C.R
Hey,
sorry for the late reply. That fixed it! Thank you.
Regards,
Geert
Sandeep.C.R - 2009-06-30 07:45:22 - In reply to message 5 from geert van bommel
Thanks for the reply, and glad to know that the issue has been fixed.
Regards,
Sandeep.
|