2 ms·
I usually try not to use the stuff that's strictly RDBMS-specific so that if I need to move it's not a huge hassle, but DAMN: connection.CreateFunction(
by yread 6y ago
I usually try not to use the stuff that's strictly RDBMS-specific so that if I need to move it's not a huge hassle, but DAMN:
connection.CreateFunction(
"regexp",
(string pattern, string input)
=> Regex.IsMatch(input, pattern));
var command = connection.CreateCommand();
command.CommandText =
@"
SELECT count()
FROM user
WHERE bio REGEXP '\w\. {2,}\w'
";
var count = command.ExecuteScalar();
- bob1029 6y agoYes. Also consider the implications of: var myUdfInstance = new MyUdfInstance(connection); connection.CreateFunction( "Execute", (string command) => myUdfInstance.ExecuteSql(command)); I can confirm this actually works. It stacks up nicely in the debugger too.