Version 4.7.23
This commit is contained in:
1 parent
7124a02564
commit
25ddeb65d6
1791 files changed
+76990
-44452
No files matched your search
+20
-1
@@ -10,6 +10,8 @@
|
||||
|
||||
namespace IPS\Db;
|
||||
|
||||
use function preg_replace;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
@@ -100,7 +102,24 @@ class _Select implements \Iterator, \Countable
|
||||
{
|
||||
return \IPS\Db::_replaceBinds( $this->query, array_merge( $this->joinBinds, $this->binds ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a max execution time for this query
|
||||
*
|
||||
* @param int $milliseconds Number of milliseconds to set as the max execution time
|
||||
* @return \IPS\Db\Select
|
||||
*/
|
||||
public function setExecutionTime( int $milliseconds )
|
||||
{
|
||||
/* This feature was introduced in MySQL 5.7.4 @note https://dev.mysql.com/doc/refman/8.4/en/optimizer-hints.html#optimizer-hints-execution-time */
|
||||
if ( ! mb_stristr( \IPS\Db::i()->server_info, '-MariaDB' ) and \IPS\Db::i()->server_version >= 50704 )
|
||||
{
|
||||
$this->query = preg_replace( '/(^SELECT\s+)([a-z]|\*)/', "$1 /*+ MAX_EXECUTION_TIME({$milliseconds}) */ $2", $this->query, 1 );
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Force an index
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user