Post by hawatus on Apr 10, 2022 1:27:39 GMT
Hello,
Im trying to use regexp with simplesql and Im getting this error:
sql example:
Found out that regexp is not defined by default in sqllite and you need to add it as a user function:
stackoverflow.com/questions/5071601/how-do-i-use-regex-in-a-sqlite-query
"SQLite does not contain regular expression functionality by default.
It defines a REGEXP operator, but this will fail with an error message unless you or your framework define a user function called regexp(). How you do this will depend on your platform."
www.sqlite.org/c3ref/create_function.html
Something like this:
docs.microsoft.com/en-us/dotnet/standard/data/sqlite/user-defined-functions
thank you for your wonderful product. hope you can provide a solution!
Im trying to use regexp with simplesql and Im getting this error:
SQLiteException: no such function: REGEXP
SimpleSQL.SQLite3.Prepare3 (System.IntPtr db, System.String query) (at <207fc23201404c1f986749afb0ece901>:0)
SimpleSQL.SQLiteCommand.Prepare3 () (at <207fc23201404c1f986749afb0ece901>:0)
SimpleSQL.SQLiteCommand.ExecuteQuery[T] (SimpleSQL.TableMapping map) (at <207fc23201404c1f986749afb0ece901>:0)
SimpleSQL.SQLiteCommand.ExecuteQuery[T] () (at <207fc23201404c1f986749afb0ece901>:0)
SimpleSQL.SQLiteConnection.Query[T] (System.String query, System.Object[] args) (at <207fc23201404c1f986749afb0ece901>:0)
SimpleSQL.SimpleSQLManager.Query[T] (System.String query, System.Object[] args) (at <207fc23201404c1f986749afb0ece901>:0)
sql example:
SELECT * FROM Entry WHERE description REGEXP '\b(?<!...)([mait]+){2,100}\b(?![.-])'
Found out that regexp is not defined by default in sqllite and you need to add it as a user function:
stackoverflow.com/questions/5071601/how-do-i-use-regex-in-a-sqlite-query
"SQLite does not contain regular expression functionality by default.
It defines a REGEXP operator, but this will fail with an error message unless you or your framework define a user function called regexp(). How you do this will depend on your platform."
www.sqlite.org/c3ref/create_function.html
Something like this:
docs.microsoft.com/en-us/dotnet/standard/data/sqlite/user-defined-functions
connection.CreateFunction(
"regexp",
(string pattern, string input)
=> Regex.IsMatch(input, pattern));
thank you for your wonderful product. hope you can provide a solution!