mirror of
https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress.git
synced 2025-07-31 10:17:13 +02:00
Correct SQL_CALC_FOUND_ROWS handling as it was broken by the latest code reorganisation
git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@436152 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
@ -129,12 +129,6 @@
|
|||||||
if( false === strpos($err, 'relation "'.$wpdb->options.'"'))
|
if( false === strpos($err, 'relation "'.$wpdb->options.'"'))
|
||||||
error_log("Error running :\n$initial\n---- converted to ----\n$sql\n----\n$err\n---------------------\n", 3, PG4WP_LOG.'pg4wp_errors.log');
|
error_log("Error running :\n$initial\n---- converted to ----\n$sql\n----\n$err\n---------------------\n", 3, PG4WP_LOG.'pg4wp_errors.log');
|
||||||
|
|
||||||
if( $catchnumrows && $GLOBALS['pg4wp_result'] !== false)
|
|
||||||
{
|
|
||||||
$GLOBALS['pg4wp_numrows_query'] = $sql;
|
|
||||||
if( PG4WP_DEBUG)
|
|
||||||
error_log( "Number of rows required for :\n$sql\n---------------------\n", 3, PG4WP_LOG.'pg4wp_NUMROWS.log');
|
|
||||||
}
|
|
||||||
return $GLOBALS['pg4wp_result'];
|
return $GLOBALS['pg4wp_result'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,8 +160,6 @@
|
|||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$logto = 'queries';
|
$logto = 'queries';
|
||||||
// This is used to catch the number of rows returned by the last "SELECT" REQUEST
|
|
||||||
$catchnumrows = false;
|
|
||||||
// The end of the query may be protected against changes
|
// The end of the query may be protected against changes
|
||||||
$end = '';
|
$end = '';
|
||||||
|
|
||||||
@ -180,12 +172,14 @@
|
|||||||
// SQL_CALC_FOUND_ROWS doesn't exist in PostgreSQL but it's needed for correct paging
|
// SQL_CALC_FOUND_ROWS doesn't exist in PostgreSQL but it's needed for correct paging
|
||||||
if( false !== strpos($sql, 'SQL_CALC_FOUND_ROWS'))
|
if( false !== strpos($sql, 'SQL_CALC_FOUND_ROWS'))
|
||||||
{
|
{
|
||||||
$catchnumrows = true;
|
|
||||||
$sql = str_replace('SQL_CALC_FOUND_ROWS', '', $sql);
|
$sql = str_replace('SQL_CALC_FOUND_ROWS', '', $sql);
|
||||||
|
$GLOBALS['pg4wp_numrows_query'] = $sql;
|
||||||
|
if( PG4WP_DEBUG)
|
||||||
|
error_log( "Number of rows required for :\n$sql\n---------------------\n", 3, PG4WP_LOG.'pg4wp_NUMROWS.log');
|
||||||
}
|
}
|
||||||
elseif( false !== strpos($sql, 'FOUND_ROWS()'))
|
elseif( false !== strpos($sql, 'FOUND_ROWS()'))
|
||||||
{
|
{
|
||||||
// Here we need to convert the latest query into a COUNT query
|
// Here we convert the latest query into a COUNT query
|
||||||
$sql = $GLOBALS['pg4wp_numrows_query'];
|
$sql = $GLOBALS['pg4wp_numrows_query'];
|
||||||
// Remove any LIMIT ... clause (this is the blocking part)
|
// Remove any LIMIT ... clause (this is the blocking part)
|
||||||
$pattern = '/\s+LIMIT.+/';
|
$pattern = '/\s+LIMIT.+/';
|
||||||
|
@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|||||||
Tags: database, postgresql, PostgreSQL, postgres, mysql
|
Tags: database, postgresql, PostgreSQL, postgres, mysql
|
||||||
Requires at least: 2.5.1
|
Requires at least: 2.5.1
|
||||||
Tested up to: 3.2.1
|
Tested up to: 3.2.1
|
||||||
Stable tag: 1.2.1
|
Stable tag: 1.2.2
|
||||||
|
|
||||||
PostgreSQL for WordPress is a special 'plugin' enabling WordPress to be used with a PostgreSQL database.
|
PostgreSQL for WordPress is a special 'plugin' enabling WordPress to be used with a PostgreSQL database.
|
||||||
|
|
||||||
@ -43,6 +43,9 @@ There is no screenshot for this plugin
|
|||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 1.2.2 =
|
||||||
|
* Corrected SQL_CALC_FOUND_ROWS handling, was broken by the latest code reorganisation
|
||||||
|
|
||||||
= 1.2.1 =
|
= 1.2.1 =
|
||||||
* Corrected 'ON DUPLICATE KEY ...' handling (was not working at all)
|
* Corrected 'ON DUPLICATE KEY ...' handling (was not working at all)
|
||||||
* Modified SQL_CALC_FOUND_ROWS handling for correct paging
|
* Modified SQL_CALC_FOUND_ROWS handling for correct paging
|
||||||
|
Reference in New Issue
Block a user