aboutsummaryrefslogtreecommitdiff
path: root/app/Models/EntryDAOPGSQL.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Models/EntryDAOPGSQL.php')
-rw-r--r--app/Models/EntryDAOPGSQL.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/Models/EntryDAOPGSQL.php b/app/Models/EntryDAOPGSQL.php
index 8adeffe9e..fe157308c 100644
--- a/app/Models/EntryDAOPGSQL.php
+++ b/app/Models/EntryDAOPGSQL.php
@@ -23,6 +23,32 @@ class FreshRSS_EntryDAOPGSQL extends FreshRSS_EntryDAOSQLite {
return rtrim($sql, ' ;') . ' ON CONFLICT DO NOTHING';
}
+ #[\Override]
+ protected static function sqlRegex(string $expression, string $regex, array &$values): string {
+ $matches = static::regexToSql($regex);
+ if (isset($matches['pattern'])) {
+ $matchType = $matches['matchType'] ?? '';
+ if (str_contains($matchType, 'm')) {
+ // newline-sensitive matching
+ $matches['pattern'] = '(?m)' . $matches['pattern'];
+ }
+ $values[] = $matches['pattern'];
+ if (str_contains($matchType, 'i')) {
+ // case-insensitive matching
+ return "{$expression} ~* ?";
+ } else {
+ // case-sensitive matching
+ return "{$expression} ~ ?";
+ }
+ }
+ return '';
+ }
+
+ #[\Override]
+ protected function registerSqlFunctions(string $sql): void {
+ // Nothing to do for PostgreSQL
+ }
+
/** @param array<string|int> $errorInfo */
#[\Override]
protected function autoUpdateDb(array $errorInfo): bool {