Current code base I'm working on is full of ad-hoc conditional string concatenations producing less than clear SQL queries. I want to make them maintainable, but since using DBIx::Class is too complex to move to for now (giant legacy base), I'm looking to at least make them more robust by using some sort of SQL generator, which would only create the SQL by object-orientation or any other clean technique (no DB handling necessary).
One general constraint on that generator is the ability to use stored procedures in a sane way, since my application is mostly based on those. For example, I need to SELECT * FROM StoredProcedure(Parameter) WHERE ...
. I've looked into Fey::SQL, SQL::Abstract and some others, but haven't seen any support apart from "inline SQL" for this kind of statement. Neither have I seen any support for EXECUTE ...
, not even in DBIx::Class, which I frankly can't really believe, probably I've been looking in wrong places.
I actually liked Fey::SQL's approach, until I found out it required some sort of scheme:
$select->select( $user->columns( 'user_id', 'username' ) )
->from( $user, $group )
->where( $group->group_id, 'IN', 1, 2, 3 )
->and ( $func, 'LIKE', 'smith%' );
What would you recommend?