Subject: | Add Regex Support? |
Date: | Mon, 10 Apr 2006 10:22:59 -0700 |
To: | bug-dbd-sqlite [...] rt.cpan.org |
From: | David Wheeler <dwheeler [...] cpan.org> |
It'd be cool if DBD::SQLite could automatically add a regexp()
function with Perl regular expression support. I do it in my code
like this:
$dbh->func('regexp', 2, sub {
my ($regex, $string) = @_;
return $string =~ /$regex/;
}, 'create_function');
Why do I do this? Because then the SQLite REGEXP function will just
use it in queries:
my $sel = $dbh->prepare('SELECT a FROM try WHERE a REGEXP ?');
But it'd be really cool if DBD::SQLite defined the regexp() function
in C/XS, so that we all get this benefit all the time.
I blogged about this functionality here:
http://www.justatheory.com/computers/databases/sqlite/
add_regexen.html
So, file this under Wishlist. :-)
Best,
David