-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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) (…
…#18371) * Allow to distinguish between MySQL and MariaDB (also in installation) * updates expected UI test files * add tests * run tests with MariaDb * adjust some tests to work with MariaDb * submodule update * ensure static order for custom dimensions * fix userid tests * fix max execution time tests * adjust action param * Use database engine instead of schema in frontend * skip test on Mariadb * Apply suggestions from code review * Update .github/workflows/matomo-tests.yml * updates expected UI test files * fix diagnostic check * Recreate OmniFixture after fixture changes * updates expected UI test files * improve ui test * Apply suggestions from code review Co-authored-by: Marc Neudert <[email protected]> * improve mariadb diagnostic * submodule update --------- Co-authored-by: Michal Kleiner <[email protected]> Co-authored-by: Marc Neudert <[email protected]>
- Loading branch information
1 parent
9deb8c7
commit 2743e52
Showing
57 changed files
with
1,253 additions
and
1,122 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
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,40 @@ | ||
<?php | ||
|
||
/** | ||
* Matomo - free/libre analytics platform | ||
* | ||
* @link https://matomo.org | ||
* @license https://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 0 | ||
* | ||
* @param string $sql query to add hint to | ||
* @param float $limit time limit in seconds | ||
* @return string | ||
*/ | ||
public function addMaxExecutionTimeHintToQuery(string $sql, float $limit): string | ||
{ | ||
if ($limit <= 0) { | ||
return $sql; | ||
} | ||
|
||
$sql = trim($sql); | ||
$pos = stripos($sql, 'SELECT'); | ||
$isMaxExecutionTimeoutAlreadyPresent = (stripos($sql, 'max_statement_time=') !== false); | ||
if ($pos !== false && !$isMaxExecutionTimeoutAlreadyPresent) { | ||
$maxExecutionTimeHint = 'SET STATEMENT max_statement_time=' . ceil($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
Oops, something went wrong.