OK, thanks for the swift reply. I've attached a test file 02generate.t.
If it's too much trouble (or impossible), don't bother. For me it's
going to be way easier to simply not upgrade; I really only wanted to
use the promising new DBIx::Class::Helper::ResultSet::SetOperations.
All my existing catalyst code has lots and lots of:
->search({ REGEXP => ... and
->search({ GLOB => '*str*' ...
which I can't easily change.
Thanks for the link to the unary-op, but I've got no idea what the doc
is trying to say. I don't know how to make my own GLOB or REGEXP ops,
and really wouldn't know how to get them into the catalyst app.
I guess I'm surprised that no one else uses GLOB, but I'm not surprised
that I've been doing it wrong all this time.
Thanks for your time, -j
#!/usr/bin/perl
use strict;
use warnings;
use Test::More;
use Test::Exception;
use SQL::Abstract::Test import => ['is_same_sql_bind'];
use Data::Dumper;
use SQL::Abstract;
my $not_stringifiable = bless {}, 'SQLA::NotStringifiable';
my @handle_tests = (
{
where => {
foo => {'GLOB' => '*str*'},
},
stmt => " WHERE foo GLOB ? ",
bind => [ '*str*' ],
},
{
where => {
foo => {'REGEXP' => 'bar|baz'},
},
stmt => " WHERE foo REGEXP ? ",
bind => [ 'bar|baz' ],
},
);
plan tests => ( @handle_tests * 2 ) + 1;
for my $case (@handle_tests) {
local $Data::Dumper::Terse = 1;
my $sql = SQL::Abstract->new;
my($stmt, @bind);
lives_ok (sub {
($stmt, @bind) = $sql->where($case->{where}, $case->{order});
is_same_sql_bind($stmt, \@bind, $case->{stmt}, $case->{bind})
|| diag "Search term:\n" . Dumper $case->{where};
});
}
dies_ok {
my $sql = SQL::Abstract->new;
$sql->where({ foo => { '>=' => [] }},);
};