From 57187fa2d226564e8115cdd5c68b282609c0057d Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Mon, 26 Jun 2023 11:01:50 +1000 Subject: [PATCH] Support `SELECT DISTINCT SQL_CALC_FOUND_ROWS` --- db.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db.php b/db.php index f1a7e01..f4252dc 100644 --- a/db.php +++ b/db.php @@ -969,7 +969,7 @@ public function query( $query ) { $elapsed = $this->timer_stop(); ++$this->num_queries; - if ( preg_match( '/^\s*SELECT\s+SQL_CALC_FOUND_ROWS\s/i', $query ) ) { + if ( preg_match( '/^\s*SELECT\s+(DISTINCT\s+)?SQL_CALC_FOUND_ROWS\s/i', $query ) ) { if ( false === strpos( $query, 'NO_SELECT_FOUND_ROWS' ) ) { $this->timer_start(); $this->last_found_rows_result = $this->ex_mysql_query( 'SELECT FOUND_ROWS()', $this->dbh );