Skip to content

Commit 959523a

Browse files
committed
Query: support SELECT modifiers
Ported from HyperDB. See: Automattic/HyperDB#137
1 parent fa412d1 commit 959523a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: ludicrousdb/includes/class-ludicrousdb.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1303,6 +1303,7 @@ public function check_connection( $allow_bail = true, $dbh_or_table = false, $qu
13031303
* Basic query. See documentation for more details.
13041304
*
13051305
* @since 1.0.0
1306+
* @since 5.2.0 Added support for SELECT modifiers (e.g. DISTINCT, HIGH_PRIORITY, etc...)
13061307
*
13071308
* @param string $query Query.
13081309
*
@@ -1410,7 +1411,7 @@ public function query( $query ) {
14101411

14111412
++ $this->num_queries;
14121413

1413-
if ( preg_match( '/^\s*SELECT\s+SQL_CALC_FOUND_ROWS\s/i', $query ) ) {
1414+
if ( preg_match( '/^\s*SELECT\s+([A-Z_]+\s+)*SQL_CALC_FOUND_ROWS\s/i', $query ) ) {
14141415
if ( false === strpos( $query, 'NO_SELECT_FOUND_ROWS' ) ) {
14151416
$this->timer_start();
14161417
$this->last_found_rows_result = $this->_do_query( 'SELECT FOUND_ROWS()', $this->dbh );

0 commit comments

Comments
 (0)