From 8f7d699b4eb627b1c7e9f7255bf8e1b51d18ed26 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Fri, 18 Aug 2023 20:42:47 +0200 Subject: [PATCH] Implement sqlite REGEXP --- Elwig/Windows/QueryWindow.xaml.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Elwig/Windows/QueryWindow.xaml.cs b/Elwig/Windows/QueryWindow.xaml.cs index a26bd8e..6bcc98b 100644 --- a/Elwig/Windows/QueryWindow.xaml.cs +++ b/Elwig/Windows/QueryWindow.xaml.cs @@ -3,6 +3,7 @@ using Microsoft.Data.Sqlite; using System; using System.Collections.Generic; using System.Data.Common; +using System.Text.RegularExpressions; using System.Windows; using System.Windows.Controls; using System.Windows.Data; @@ -26,6 +27,7 @@ namespace Elwig.Windows { IList header; using (var cnx = new SqliteConnection(AppDbContext.ConnectionString)) { + cnx.CreateFunction("REGEXP", (pattern, value) => value == null ? null : Regex.Match(value, pattern).Success, true); cnx.Open(); var cmd = cnx.CreateCommand(); cmd.CommandText = sqlQuery;