I've finished the new DB layer for Roundcube based on PHP PDO. It uses less memory (1.2 MB less) and should be faster than our old solution. The main differences: uses PDO modules, no prepared statements.
Please, get 'pdo' branch and give it a try, so we could use this in 0.9.
Please, get 'pdo' branch and give it a try, so we could use this in 0.9.
The new class does not have the method num_rows, though it looks like the method affected_rows does the same job so may be this is just a backwards compatibility issue. rcube_contacts uses the num_rows method.
Phil
On 07/14/2012 02:54 PM, Phil Weir wrote:
The new class does not have the method num_rows, though it looks like the method affected_rows does the same job so may be this is just a backwards compatibility issue. rcube_contacts uses the num_rows method.
affected_rows() is not the same. It shouldn't be used for SELECT statements. I removed num_rows() because it was used only in one place and because it can be simply replaced by looping on fetch_array() if needed. rcube_contacts doesn't use num_rows() any more.
On 23-07-12 09:23, A.L.E.C wrote:
affected_rows() is not the same. It shouldn't be used for SELECT statements. I removed num_rows() because it was used only in one place and because it can be simply replaced by looping on fetch_array() if needed. rcube_contacts doesn't use num_rows() any more.
It occurs to me that looping on a (large) data set is quite inefficient, one could better use a SELECT COUNT() to find the number of rows.
@Phil: PDO does not offer a function like num_rows, it only offers rowCount() (http://php.net/manual/en/pdostatement.rowcount.php) which returns the number of affected rows. In MySQL, the effect is the same (rowCount returns the number of rows in a select) but this behavior does not necessarily extend to other databases. It would be safer to rely on other methods to find the number of rows.
Cheers, Geert
Hi,
Am 09-07-2012 11:11, schrieb A.L.E.C:
I've finished the new DB layer for Roundcube based on PHP PDO. It uses less memory (1.2 MB less) and should be faster than our old solution. The main differences: uses PDO modules, no prepared statements.
Please, get 'pdo' branch and give it a try, so we could use this in 0.9.
I have today downloaded the current pdo branch and it looks very nice.
I use it now as primary installation and will report if I see some problems.
Best regards Aleks
On 10/29/2012 01:10 AM, Aleksandar Lazic wrote:
I have today downloaded the current pdo branch and it looks very nice.
I use it now as primary installation and will report if I see some problems.
It's already merged with master (and there were some fixes since), so use master.