-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to distinguish between MySQL and MariaDB (also in installation)
- Loading branch information
Showing
8 changed files
with
102 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/** | ||
* Matomo - free/libre analytics platform | ||
* | ||
* @link https://matomo.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* | ||
*/ | ||
namespace Piwik\Db\Schema; | ||
|
||
/** | ||
* Mariadb schema | ||
*/ | ||
class Mariadb extends Mysql | ||
{ | ||
/** | ||
* Adds a max_statement_time hint into a SELECT query if $limit is bigger than 1 | ||
* | ||
* @param string $sql query to add hint to | ||
* @param int $limit time limit in seconds | ||
* @return string | ||
*/ | ||
public static function addMaxExecutionTimeHintToQuery($sql, $limit) | ||
{ | ||
if ($limit <= 0) { | ||
return $sql; | ||
} | ||
|
||
$sql = trim($sql); | ||
$pos = stripos($sql, 'SELECT'); | ||
if ($pos !== false) { | ||
$maxExecutionTimeHint = 'SET STATEMENT max_statement_time='.$limit.' FOR '; | ||
$sql = substr_replace($sql, $maxExecutionTimeHint . 'SELECT', $pos, strlen('SELECT')); | ||
} | ||
|
||
return $sql; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters