good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Concrete SQL from SQL::Abstract?by benizi (Hermit) |
on May 13, 2010 at 18:08 UTC ( [id://839885]=perlquestion: print w/replies, xml ) | Need Help?? |
benizi has asked for the wisdom of the Perl Monks concerning the following question: I've been using DBI + SQL::Abstract for a lot of stuff, and one of the things I need to do now is generate concrete SQL scripts. For example, SQL::Abstract makes converting a hash into an insert extremely simple:
But, now I have an occasion where I need to get parameter-free SQL to execute in a (My)SQL script. E.g., given the above example, I'd like to turn $insert and @bind back into: INSERT INTO atable ( a, b, c) VALUES ( NULL, 1, 'string' )Part of the problem is terminology. The only keywords I can think of { SQL, literal, abstract, bind, parameters, quoting } all get tons of results in the direction I've been using SQL::Abstract. (That is: ways to use tools like DBI that promote the use of placeholders, etc.) I'm wondering whether there's a DBD driver that will do this. (e.g. change the connect string to something like 'DBI:fakesql:dialect=mysql', where 'fakesql' is the module I'm unable to find) Or is there another tool that I'm overlooking?
Back to
Seekers of Perl Wisdom
|
|