Add support for correcting COUNT(*)...ORDER BY... statements

git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@225162 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
hawk__
2010-04-04 09:45:30 +00:00
parent 65b683b42b
commit f3af016f8a

View File

@@ -120,6 +120,8 @@
{
$sql = $GLOBALS['pg4wp_numrows'];
}
// Handle COUNT(*)...ORDER BY...
$sql = preg_replace( '/COUNT(.+)ORDER BY.+', 'COUNT$1', $sql);
$pattern = '/LIMIT[ ]+(\d+),[ ]*(\d+)/';
$sql = preg_replace($pattern, 'LIMIT $2 OFFSET $1', $sql);