Implement sqlite REGEXP

This commit is contained in:
2023-08-18 20:42:47 +02:00
parent b87710cc67
commit 8f7d699b4e

View File

@ -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<DbColumn> header;
using (var cnx = new SqliteConnection(AppDbContext.ConnectionString)) {
cnx.CreateFunction<string, string?, bool?>("REGEXP", (pattern, value) => value == null ? null : Regex.Match(value, pattern).Success, true);
cnx.Open();
var cmd = cnx.CreateCommand();
cmd.CommandText = sqlQuery;