Skip to content

Commit

Permalink
Utils: createSqlHash: Fix support for Windows platform in regex, cred…
Browse files Browse the repository at this point in the history
…it @ HamAndRock
  • Loading branch information
janbarasek authored Mar 20, 2020
1 parent 425832e commit a07a7eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static function createSqlHash(string $sql): string
{
$sql = (string) preg_replace('/\'[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}\'/', '\'uuid\'', $sql);
$sql = (string) preg_replace('/[^\']+/', '\'string\'', $sql);
$sql = (string) preg_replace('/(\w+)(?:\s*=\s*(?:[\'"].*?[\'"]|[\d-.]+)|\s+IN\s+\([^\)]+\))/', '$1 = \?', $sql);
$sql = (string) preg_replace('/(\w+)(?:\s*=\s*(?:[\'"].*?[\'"]|[\d\-\.]+)|\s+IN\s+\([^\)]+\))/', '$1 = \?', $sql);

return md5($sql);
}
Expand Down

0 comments on commit a07a7eb

Please sign in to comment.