Mark Lawrence wrote:
The perldoc for SQL::Abstract itself shows just how difficult this is
even for relatively simple cases:
%where = (
lname => {like => '%son%'},
age => [-and => {'>=', 10}, {'<=', 20}],
);
Again, remember that the -and goes inside the arrayref.
There is another *implicit* AND between the two conditions. At first
(and second glance) this is very different from the actual intended SQL,
not to mention the complexity of other artifical constructs like -nest.
A much better mapping can be obtained with Perl's built-in logic operators.
Actually, for a project I needed to write a parser from simple search
expressions
into DBIx::Class. I was surprised by how simple it was to write the
actions that got me a DBIx::Class search hash from a grammar with
comparison operators, and, or and not. (Not was the hardest, because
SQL::Abstract doesn't directly support it, but even then it was just a
couple of hours).
Matija
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]