I am using the DBIx::Class
module and I am trying to do the following query:
SELECT * FROM MyTable WHERE column > TIMESTAMP
I am extremely new to Perl especially DBIx::Class
so I really only know how to do a basic select where a column is equal to a value. How can I do it using other comparators?
DBIx::Class
uses SQL::Abstract
to specify its WHERE
clauses, so the documentation for that module is worth reading.
You will be used to things like
$schema->resultset('MyTable')->search({column => 42});
to find records with a specific valued in a column. To use a specific, non-equality operator you would use an anonymous hash that contains the operator and the value instead of just a bare value. Like this
$schema->resultset('MyTable')->search({column => { '>' => 42}});
and to use a specific SQL expression instead of a bound value you just pass a reference instead, like so
$schema->resultset('MyTable')->search({timestamp => { '>' => \'TIMESTAMP'}});