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:
@@ -120,6 +120,8 @@
|
|||||||
{
|
{
|
||||||
$sql = $GLOBALS['pg4wp_numrows'];
|
$sql = $GLOBALS['pg4wp_numrows'];
|
||||||
}
|
}
|
||||||
|
// Handle COUNT(*)...ORDER BY...
|
||||||
|
$sql = preg_replace( '/COUNT(.+)ORDER BY.+', 'COUNT$1', $sql);
|
||||||
|
|
||||||
$pattern = '/LIMIT[ ]+(\d+),[ ]*(\d+)/';
|
$pattern = '/LIMIT[ ]+(\d+),[ ]*(\d+)/';
|
||||||
$sql = preg_replace($pattern, 'LIMIT $2 OFFSET $1', $sql);
|
$sql = preg_replace($pattern, 'LIMIT $2 OFFSET $1', $sql);
|
||||||
|
Reference in New Issue
Block a user