Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What, if any, are the disadvantages of SQL::Interp over SQL::Abstract?

Tags:

sql

perl

I'm currently looking at some light-weight SQL abstraction modules. My workflow is such that i usually write SELECT queries manually, and INSERT/UPDATE queries via subs which take hashes.

Both of these modules seem perfect for my needs and i have a hard time deciding. SQL::Interp claims SQL::Abstract cannot provide full expressivity in SQL, but discusses no other differences.

Does it have any disadvantages? If so, which?

like image 274
Mithaldu Avatar asked Aug 07 '10 07:08

Mithaldu


2 Answers

I can't speak to SQL::Interp, but I use SQL::Abstract and it's pretty good. In conjunction with DBIx::Connector and plain old DBI, I was able to totally eliminate the use of an ORM in my system with very little downside.

The only limitations I have run into is that it's not possible to write GROUP BY queries directly (although it's easy to do by simply appending to the generated query, and LIMIT queries are handled by the extension SQL::Abstract::Limit.

like image 92
Ether Avatar answered Oct 04 '22 20:10

Ether


I used SQL::Abstract for a over a year, and then switched to SQL::Interp, which I've stuck with since.

SQL::Abstract had trouble with complex clauses. For the ones it could support, you would end up with a nest of "(" "[" and {" characters, which you were mentally translate back to meaning "AND", "OR" or actually parentheses.

SQL::Interp has no such limitations and uses no middle representation. Your SQL looks like SQL with bind variables where you want them. It works for complex queries as well as simple ones. I find SQL::Interp especially pleasant to use in combination with DBIx::Simple's built-in support for it. DBIx::Simple+SQL::Interp is a friendly and intuitive replacement for using raw DBI. I use the combination in a 100,000k+ LoC mod_perl web app.

like image 44
Mark Stosberg Avatar answered Oct 04 '22 21:10

Mark Stosberg