Translate between DBI and SQL

--0000000000009566140581699ac3
Content-Type: text/plain; charset="UTF-8"

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

--0000000000009566140581699ac3
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">Has anyone done any work on converting SQL queries betwee=
n RDBMS and perl?<div dir=3D"auto"><br></div><div dir=3D"auto">My particula=
r interest is DBD::Pg but anything would be of use</div><div dir=3D"auto"><=
br></div><div dir=3D"auto">It would be very useful when I am testing comple=
x SQL, it&#39;s very easy to miss a \ or quote between the two=C2=A0</div><=
div dir=3D"auto"><br></div><div dir=3D"auto">Thanks=C2=A0</div><div dir=3D"=
auto">Mike</div><div dir=3D"auto"><br></div></div>

--0000000000009566140581699ac3--
0
redtux1
2/8/2019 10:37:17 PM
perl.dbi.users 11081 articles. 1 followers. Follow

7 Replies
83 Views

Similar Articles

[PageSpeed] 42

--_000_YQBPR0101MB21967DF79B17EC79B31C5881D0690YQBPR0101MB2196_
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64

V2VsbCBub3QgcmVhbGx5IG11Y2ggREJJIGNhbiBkbyBmb3IgeW91LiAgWW91IHVzdWFsbHkgc3Rh
cnQgZnJvbSBzY3JhdGNoIHRyeWluZyB0byB3cml0ZSBTUUwgdGhhdCBpcyBub3QgRHJpdmVyIFNw
ZWNpZmljIHRob3VnaCB0aGF0IGNhbiBiZSBoYXJkLg0KDQp5b3UgYXJlIHVzdWFsbHkgc3R1Y2sg
d2l0aCBzb21ldGhpbmcgbGlrZSB0aGlzDQoNCnN1YiBlZGl0X3NxbCB7DQogICAgbXkgKCRzZWxm
LCAkc3FsKSA9IEBfO+KAiw0K4oCLDQogICAgaWYgKCRzZWxmLT5pc1Bvc3RncmVzKSB74oCLDQog
ICAgICAgIHJldHVybiBJbmZvcm1peFRvUGdzU1FMOjpt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GVtIGltbWVkaWF0
ZWx5LiBBbnkgY29tbWVudHMgb3Igc3RhdGVtZW50cyBjb250YWluZWQgaW4gdGhpcyB0cmFuc21p
c3Npb24gZG8gbm90IG5lY2Vzc2FyaWx5IHJlZmxlY3QgdGhlIHZpZXdzIG9yIHBvc2l0aW9uIG9m
IFJhZGlhbCBvciBpdHMgc3Vic2lkaWFyaWVzIGFuZC9vciBhZmZpbGlhdGVzLg0KDQoNCg==
0
fennellb
2/11/2019 4:48:05 PM
On Friday 08 February 2019 22:37:17 Mike Martin 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

Hi! Maybe following module could be interesting:
https://metacpan.org/pod/DBIx::Perlish
0
pali
2/11/2019 4:49:19 PM
------------3804-1549991465925-1
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8

Short answer, assuming you are including hard-coded SQL into a Perl script:=

Place the textual SQL, without any additional backslashes or extra quotes o=
r whatsoever,
within the following:

my $sql_text =3D q(
<here goes your SQL>
);

Unless you have a closing ")" without a preceding opening "(" in that SQL t=
ext
(which would normally be invalid SQL)
the above should be valid Perl, resulting in a valid SQL statement in $sql_=
text
(to be passed to a DBI prepare or so).

In the unlikely event that you would have unbalanced quoted parentheses in =
your SQL,
you can replace the delimiters for the q operator by something else, viz. s=
omething not occurring in your SQL text, e.g.:

my $sql_text =3D q#
SELECT ')', "col_a"
FROM tblc
ORDER BY "col_a"
#;


-- Peter.


8 februari 2019 23:37:17 +01:00, skrev Mike Martin <redtux1@gmail.com>:

> Has anyone done any work on converting SQL queries between RDBMS and perl=
?
>=20
> My particular interest is DBD::Pg but anything would be of use
>=20
> 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
> 
> 


------------3804-1549991465925-1
Content-Type: multipart/related; boundary="----------3804-1549991465925-2"

------------3804-1549991465925-2
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<div>Short answer, assuming you are including hard-coded SQL into a Perl sc=
ript:<br></div><div>Place the textual SQL, without any additional backslash=
es or extra quotes or whatsoever,<br></div><div>within the following:<br></=
div><div><br></div><div>my $sql_text =3D q(<br></div><div>=C2=A0=C2=A0 &lt;=
here goes your SQL><br></div><div>);<br></div><div><br></div><div>Unless yo=
u have a closing ")" without a preceding opening "(" in that SQL text<br></=
div><div>(which would normally be invalid SQL)<br></div><div>the above shou=
ld be valid Perl, resulting in a valid SQL statement in $sql_text<br> (to b=
e passed to a DBI prepare or so).<br></div><div><br></div><div>In the unlik=
ely event that you would have unbalanced quoted parentheses in your SQL,<br=
></div><div>you can replace the delimiters for the q operator by something =
else, viz. something not occurring in your SQL text, e.g.:<br></div><div><b=
r></div><div>my $sql_text =3D q#<br></div><div>=C2=A0=C2=A0 SELECT ')', "co=
l_a"<br></div><div>=C2=A0=C2=A0 FROM=C2=A0 tblc<br></div><div>=C2=A0=C2=A0 =
ORDER BY "col_a"<br></div><div>#;<br></div><div><div><br></div><div>--=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0 Peter.<br></div></div><div><br></div><div><br></di=
v><div>8 februari 2019 23:37:17 +01:00, skrev Mike Martin &lt;redtux1@gmail=
..com>:<br></div><blockquote type=3D"cite"><div><div>Has anyone done any wor=
k on converting SQL queries between RDBMS and perl?<br></div><div><br></div=
><div>My particular interest is DBD::Pg but anything would be of use<br></d=
iv><div><br></div><div>It would be very useful when I am testing complex SQ=
L, it's very easy to miss a \ or quote between the two=C2=A0<br></div><div>=
<br></div><div>Thanks=C2=A0<br></div><div>Mike<br></div><div><br></div></di=
v></blockquote><div><br></div>

------------3804-1549991465925-2--
------------3804-1549991465925-1--
0
peter
2/12/2019 5:11:05 PM
--0000000000008312790581b662b8
Content-Type: text/plain; charset="UTF-8"

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

--0000000000008312790581b662b8
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><br></div>Tie::Function can be used to bind $dbh-&gt;=
quote to a syntactical hash, so you can interpolate arbitrary strings easie=
r. When I do that I name the hash %Q, and then it&#39;s safe to do things l=
ike<div><br></div><div>$sql_text =3D &quot;select id from mytable where foo=
=3D$Q{$foo}&quot;;</div><div><br></div><div>rather than counting placeholde=
rs.<br><div><br></div><div><br></div></div></div><br><div class=3D"gmail_qu=
ote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Feb 8, 2019 at 4:37 PM M=
ike Martin &lt;<a href=3D"mailto:redtux1@gmail.com">redtux1@gmail.com</a>&g=
t; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0p=
x 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div d=
ir=3D"auto">Has anyone done any work on converting SQL queries between RDBM=
S and perl?<div dir=3D"auto"><br></div><div dir=3D"auto">My particular inte=
rest is DBD::Pg but anything would be of use</div><div dir=3D"auto"><br></d=
iv><div dir=3D"auto">It would be very useful when I am testing complex SQL,=
 it&#39;s very easy to miss a \ or quote between the two=C2=A0</div><div di=
r=3D"auto"><br></div><div dir=3D"auto">Thanks=C2=A0</div><div dir=3D"auto">=
Mike</div><div dir=3D"auto"><br></div></div>
</blockquote></div><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr"=
 class=3D"gmail_signature"><div dir=3D"ltr"><div>&quot;I don&#39;t know abo=
ut that, as it is outside of my area of expertise.&quot; -- competent speci=
alized practitioners, all the time</div></div></div>

--0000000000008312790581b662b8--
0
davidnicol
2/12/2019 6:13:04 PM
Reply: