Skip to content

Commit

Permalink
修复 Swoole PgSQL SQL 解析问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Oct 22, 2021
1 parent f5ad69f commit f54cf5e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Db/Util/SqlUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ public static function parseSqlWithParams(string $sql, ?array &$map): string

$i = 0;

return preg_replace_callback('/([^:]:([a-zA-Z0-9_]+)|\?)/', function (array $match) use (&$map, &$i): string {
$map[] = $match[2] ?? $match[0];
return preg_replace_callback('/([^:])(:([a-zA-Z0-9_]+)|\?)/', function (array $match) use (&$map, &$i): string {
$map[] = $match[3] ?? $match[1];

return '$' . (++$i);
return $match[1] . '$' . (++$i);
}, $sql);
}

Expand Down

0 comments on commit f54cf5e

Please sign in to comment.