From 7e63ec4e1ca126daf62d6b2967668eef9ee7b8e9 Mon Sep 17 00:00:00 2001 From: hawk__ Date: Mon, 1 Aug 2011 22:34:09 +0000 Subject: [PATCH] Corrected users listing error git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@418088 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- pg4wp/driver_pgsql.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pg4wp/driver_pgsql.php b/pg4wp/driver_pgsql.php index 8db9a5a..91012f6 100644 --- a/pg4wp/driver_pgsql.php +++ b/pg4wp/driver_pgsql.php @@ -120,10 +120,11 @@ { $catchnumrows = true; $sql = str_replace('GROUP BY '.$table_prefix.'posts.ID', '' , $sql); - $sql = str_replace('SQL_CALC_FOUND_ROWS', 'DISTINCT', $sql); - $GLOBALS['pg4wp_numrows'] = preg_replace( '/SELECT DISTINCT.+FROM ('.$table_prefix.'posts)/', 'SELECT DISTINCT "ID" FROM $1', $sql); + $GLOBALS['pg4wp_numrows'] = str_replace( 'SQL_CALC_FOUND_ROWS', 'DISTINCT', $sql); + $GLOBALS['pg4wp_numrows'] = preg_replace( '/SELECT DISTINCT.+FROM ('.$table_prefix.'posts)/', 'SELECT DISTINCT "ID" FROM $1', $GLOBALS['pg4wp_numrows']); $GLOBALS['pg4wp_numrows'] = preg_replace( '/SELECT(.+)FROM/', 'SELECT COUNT($1) FROM', $GLOBALS['pg4wp_numrows']); $GLOBALS['pg4wp_numrows'] = preg_replace( '/(ORDER BY|LIMIT).+/', '', $GLOBALS['pg4wp_numrows']); + $sql = str_replace('SQL_CALC_FOUND_ROWS', '', $sql); } elseif( false !== strpos($sql, 'FOUND_ROWS()')) {