<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>Hey SPUG Team,<BR>
<BR>
Thank you for the quick responses and all the different ways a programmer can solve this type of problem. The manual substitution method has done the trick!<BR>
<BR>
<BR>
Thank you again,<BR>
<BR>
Stephen<BR><BR><BR><BR><BR>
<HR id=stopSpelling>
<BR>
> Date: Tue, 8 Apr 2008 07:32:18 -0700<BR>> Subject: Re: SPUG: Turning off auto-quoting during DBI Binding.<BR>> From: sthoenna@efn.org<BR>> To: zstephenblum@hotmail.com<BR>> CC: spug-list@pm.org<BR>> <BR>> On Mon, Apr 07, 2008 at 08:30:35PM -0700, Stephen Blum wrote:<BR>> > How does one turn off the annoying and sometimes unneeded auto-quoting<BR>> that occurs during DBI Bindings? I have searched the net for a while<BR>> now and have found little on the subject.<BR>> ><BR>> > example:<BR>> ><BR>> > $sql = q(thrrr_id in (?));<BR>> > $sth = $dbh->prepare($sql);<BR>> > $sth->execute( q(1,2,3,4,5) );<BR>> ><BR>> > DBI executes this: thrrr_id in ('1,2,3,4,5')<BR>> > But I want to execute this: thrrr_id in (1,2,3,4,5)<BR>> ><BR>> > DBI adds quotes and I don't want them. If there is no way around this I<BR>> can forgo the performance/convenience of bindings.<BR>> <BR>> There's no way around it. Either just interpolate into the query:<BR>> <BR>> $ids = "1,2,3,4,5";<BR>> $sql = qq(thrrr_id in ($ids));<BR>> $sth = $dbh->prepare($sql);<BR>> $sth->execute();<BR>> <BR>> or use an array and provide the appropriate number of ? instead:<BR>> <BR>> @ids = (1,2,3,4,5);<BR>> $sql = 'thrrr_id in ('.join(',',('?') x @ids).')';<BR>> $sth = $dbh->prepare($sql);<BR>> $sth->execute(@ids);<BR>> <BR>> <BR>> <BR><BR></body>
</html>