develooper Front page | perl.dbi.users | Postings from February 2019

Re: Translate between DBI and SQL

Thread Previous | Thread Next
From:
David Nicol
Date:
February 12, 2019 18:13
Subject:
Re: Translate between DBI and SQL
Message ID:
CAFwScO9q1RPTXOMG4Cz8JCAfC1OORkKDfEsTkrToP2ucyT3phw@mail.gmail.com
Tie::Function can be used to bind $dbh->quote to a syntactical hash, so you
can interpolate arbitrary strings easier. When I do that I name the hash
%Q, and then it's safe to do things like

$sql_text = "select id from mytable where foo=$Q{$foo}";

rather than counting placeholders.



On Fri, Feb 8, 2019 at 4:37 PM Mike Martin <redtux1@gmail.com> wrote:

> Has anyone done any work on converting SQL queries between RDBMS and perl?
>
> My particular interest is DBD::Pg but anything would be of use
>
> It would be very useful when I am testing complex SQL, it's very easy to
> miss a \ or quote between the two
>
> Thanks
> Mike
>
>

-- 
"I don't know about that, as it is outside of my area of expertise." --
competent specialized practitioners, all the time

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About