From 7775795b06b83727d5f78e27ca32033717091ccb Mon Sep 17 00:00:00 2001 From: Angel Date: Thu, 31 Oct 2024 16:12:04 +0800 Subject: [PATCH] [fix] regex with pattern --- src/Medoo.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Medoo.php b/src/Medoo.php index dc8c5d1b..5c9eb6ae 100644 --- a/src/Medoo.php +++ b/src/Medoo.php @@ -1379,7 +1379,7 @@ protected function columnMap($columns, array &$stack, bool $root): array foreach ($columns as $key => $value) { if (is_int($key)) { - preg_match("/(" . $this::TABLE_PATTERN . ")?(?" . $this::COLUMN_PATTERN . ")(?:\s*\((?" . $this::ALIAS_PATTERN . ")\))?(?:\s*\[(?(?:String|Bool|Int|Number|Object|JSON))\])?/u", $value, $keyMatch); + preg_match("/(" . $this::TABLE_PATTERN . "\.)?(?" . $this::COLUMN_PATTERN . ")(?:\s*\((?" . $this::ALIAS_PATTERN . ")\))?(?:\s*\[(?(?:String|Bool|Int|Number|Object|JSON))\])?/u", $value, $keyMatch); $columnKey = !empty($keyMatch['alias']) ? $keyMatch['alias'] : @@ -1389,7 +1389,7 @@ protected function columnMap($columns, array &$stack, bool $root): array [$columnKey, $keyMatch['type']] : [$columnKey]; } elseif ($this->isRaw($value)) { - preg_match("/(" . $this::TABLE_PATTERN . ")?(?" . $this::COLUMN_PATTERN . ")(\s*\[(?(String|Bool|Int|Number))\])?/u", $key, $keyMatch); + preg_match("/(" . $this::TABLE_PATTERN . "\.)?(?" . $this::COLUMN_PATTERN . ")(\s*\[(?(String|Bool|Int|Number))\])?/u", $key, $keyMatch); $columnKey = $keyMatch['column']; $stack[$key] = isset($keyMatch['type']) ? @@ -1432,7 +1432,7 @@ protected function dataMap( if (count($columnsKey) === 1 && is_array($columns[$columnsKey[0]])) { $indexKey = array_keys($columns)[0]; - $dataKey = preg_replace("/^[\p{L}_][\p{L}\p{N}@$#\-_]*\./u", '', $indexKey); + $dataKey = preg_replace("/^" . $this::COLUMN_PATTERN . "\./u", '', $indexKey); $currentStack = []; foreach ($data as $item) {