[Dbix-class] searching decimal colum

Rajeev Prasad rp.neuli at yahoo.com
Fri Aug 18 20:29:37 GMT 2017


i found the solution:

my $n = 33;

my $foo_rs = $schema
    ->resultset('Test')
    ->search
    ({
        col1 => { like => '%.'.$n }
    })->count; 

    On Friday, August 18, 2017 2:35 PM, Rajeev Prasad <rp.neuli at yahoo.com> wrote:
 

 before i go an do some operations. i need to know if the following will work?

so I have this column:
col123.3323.4612.3310.3323.54623.11.33100.33

I want to run two queries
1. select all rows with 23 before decimal (not *23.*, just 23.*).
my @foo = $schema    ->resultset('Test')
    ->search
    ({
        col1 => { like => 23'.%'}
    });
    
print "values @foo\n";

I expect:23.3323.4623.54623.1
2. second i want to run query to select for given value after decimal.my $foo_rs = $schema->resultset('Table')->search({
                                                        col1 => { like => 23.'%' }});
I expect:23.3312.3310.331.33100.33


I get this error when i test:
$ ./test.pl
String found where operator expected at ./test.pl line 26, near "23'.%'"
        (Missing operator before '.%'?)
Possible unintended interpolation of @foo in string at ./test.pl line 29.
syntax error at ./test.pl line 26, near "23'.%'"
Global symbol "@foo" requires explicit package name (did you forget to declare "my @foo"?) at ./test.pl line 29.
Execution of ./test.pl aborted due to compilation errors.





   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20170818/0cb26d67/attachment-0001.htm>


More information about the DBIx-Class mailing list