------------------------------------------------------------
revno: 1032
committer: Jakub Jankiewicz <[email protected]>
branch nick: aikiframework
timestamp: Tue 2012-01-17 15:17:40 +0100
message:
Fix count with Distinct
modified:
libs/widgets.php
--
lp:aikiframework
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk
Your team Aiki Framework Developers is subscribed to branch lp:aikiframework.
To unsubscribe from this branch go to
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk/+edit-subscription
=== modified file 'libs/widgets.php'
--- libs/widgets.php 2012-01-15 14:34:17 +0000
+++ libs/widgets.php 2012-01-17 14:17:40 +0000
@@ -1266,7 +1266,8 @@
// Support DISTINCT selection
if (preg_match('/^select DISTINCT(.*) from/Usi', $sql, $distinct)){
- $mysql_count = ' count(DISTINCT({$distinc[1]})) ';
+ $dist = preg_replace('/ *as [^,]+,/Usi', ',', $distinct[1]);
+ $mysql_count = " count(DISTINCT ". $dist . ") ";
} else {
$mysql_count = ' count(*) ';
}
_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help : https://help.launchpad.net/ListHelp