in reply to How to manage sql statements

I'd been thinking about this lately myself, and you've given me the urge to search CPAN and see what's out there.

DBIx::Abstract (there's also a DBIx::AbstractLite out there, which I didn't browse) looks useful and interesting, until you reach Supported DBD Drivers and discover it's been reported to work with mySQL, PostgreSQL, and XBase, and that it should work in a lot of other situations. Sigh--it looks so nice.

Nothing else that I saw looks particularly good, so I've downloaded this and am going to try working with it at home--I'll keep you posted on my adventures. Please do some additional searching in CPAN--I'm willing to give this one a shot, if someone else will look around and see what I've missed.

adamsj

They laughed at Joan of Arc, but she went right ahead and built it. --Gracie Allen

Update: Okay, now I'm thinking DBIx::Abstract maybe isn't worth my efforts, after reading your comments. Does anyone else have suggestions? Or is it time to start rolling our own?

Replies are listed 'Best First'.
Re: Re: How to manage sql statements
by tonyday (Scribe) on Jul 13, 2001 at 10:16 UTC
    I had a good search around a few weeks back and thought that DBIx::Abstract was the best option. However, I found that I was having to bypass the abstraction a lot of the time because my statements were too complex.

    This article is a good example of the type of idea that could be abstracted (even if I don't understand it all). It shows how data manipulations that are quite easy to express end up being fiendishly complicated sql.

    VSarkiss's perlsql hybrid example was the way I expected to write sql when I first started down the perl/sql path. Just hook into a module and say...
    use SQL::GenericStatements qw(count_duplicates, cross_tab); $result = count_duplicates($dbh, $table, @columns); $result = cross_tab($dbh, @tables);
    With VSarkiss's pseudo code under the hood. Another example is the lack of a subselect in mysql. What about a "converter" of sql that overcomes the specific driver limitations.

    Seems like a *lot* of work though...

    tonyday