Medoo update 2.1.6

This commit is contained in:
gtbu 2022-06-11 11:21:45 +02:00
parent d85f41b010
commit 7627fa1e2e

View file

@ -6,10 +6,10 @@ declare(strict_types=1);
*
* The Lightweight PHP Database Framework to Accelerate Development.
*
* @version 2.1.3
* @version 2.1.6
* @author Angel Lai
* @package Medoo
* @copyright Copyright 2021 Medoo Project, Angel Lai.
* @copyright Copyright 2022 Medoo Project, Angel Lai.
* @license https://opensource.org/licenses/MIT
* @link https://medoo.in
*/
@ -105,7 +105,7 @@ class Medoo
protected $logs = [];
/**
* Determine should log or not.
* Determine should log the query or not.
*
* @var bool
*/
@ -119,7 +119,7 @@ class Medoo
protected $testMode = false;
/**
* The query string last generated in test mode.
* The last query string was generated in test mode.
*
* @var string
*/
@ -133,7 +133,7 @@ class Medoo
protected $debugMode = false;
/**
* Determine should saving debug logging.
* Determine should save debug logging.
*
* @var bool
*/
@ -478,7 +478,7 @@ class Medoo
}
/**
* Generate a new map key for placeholder.
* Generate a new map key for the placeholder.
*
* @return string
*/
@ -659,7 +659,7 @@ class Medoo
}
$query = preg_replace_callback(
'/(([`\']).*?)?((FROM|TABLE|INTO|UPDATE|JOIN)\s*)?\<(([\p{L}_][\p{L}\p{N}@$#\-_]*)(\.[\p{L}_][\p{L}\p{N}@$#\-_]*)?)\>([^,]*?\2)?/u',
'/(([`\']).*?)?((FROM|TABLE|INTO|UPDATE|JOIN|TABLE IF EXISTS)\s*)?\<(([\p{L}_][\p{L}\p{N}@$#\-_]*)(\.[\p{L}_][\p{L}\p{N}@$#\-_]*)?)\>([^,]*?\2)?/u',
function ($matches) {
if (!empty($matches[2]) && isset($matches[8])) {
return $matches[0];
@ -830,7 +830,7 @@ class Medoo
}
/**
* Implode where conditions.
* Implode the Where conditions.
*
* @param array $data
* @param array $map
@ -856,7 +856,7 @@ class Medoo
$isIndex = is_int($key);
preg_match(
'/([\p{L}_][\p{L}\p{N}@$#\-_\.]*)(\[(?<operator>\>\=?|\<\=?|\=|\!\=?|\<\>|\>\<|\!?~|REGEXP)\])?([\p{L}_][\p{L}\p{N}@$#\-_\.]*)?/u',
'/([\p{L}_][\p{L}\p{N}@$#\-_\.]*)(\[(?<operator>.*)\])?([\p{L}_][\p{L}\p{N}@$#\-_\.]*)?/u',
$isIndex ? $value : $key,
$match
);
@ -869,7 +869,7 @@ class Medoo
continue;
}
if ($operator) {
if ($operator && $operator != '=') {
if (in_array($operator, ['>', '>=', '<', '<='])) {
$condition = "{$column} {$operator} ";
@ -965,6 +965,8 @@ class Medoo
} elseif ($operator === 'REGEXP') {
$stack[] = "{$column} REGEXP {$mapKey}";
$map[$mapKey] = [$value, PDO::PARAM_STR];
} else {
throw new InvalidArgumentException("Invalid operator [{$operator}] for column {$column} supplied.");
}
continue;
@ -1165,7 +1167,7 @@ class Medoo
array &$map,
$join,
&$columns = null,
array $where = null,
$where = null,
$columnFn = null
): string {
preg_match('/(?<table>[\p{L}_][\p{L}\p{N}@$#\-_]*)\s*\((?<alias>[\p{L}_][\p{L}\p{N}@$#\-_]*)\)/u', $table, $tableMatch);
@ -1226,10 +1228,10 @@ class Medoo
}
/**
* Determine the array is with join syntax.
* Determine the array with join syntax.
*
* @param mixed $join
* @return string
* @return bool
*/
protected function isJoin($join): bool
{
@ -1562,7 +1564,7 @@ class Medoo
*/
public function drop(string $table): ?PDOStatement
{
return $this->exec('DROP TABLE IF EXISTS ' . $this->tableQuote($this->prefix . $table));
return $this->exec('DROP TABLE IF EXISTS ' . $this->tableQuote($table));
}
/**