[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



> 
> The better solution would be to use a placeholder.  Then you can prepare the
> statement once outside the foreach and pass the id when you execute it (and
> you're also less vulnerable to SQL injection attacks).
> 
> my $sth = $dbh->prepare( qq{
> SELECT id FROM assembly WHERE parts_id = ?
> });
> foreach my $id ( @clone_list ) {
>   $sth->execute( $id ) or $form->dberror( "assembly SELECT id $id" );
> 
>   while( my $row = $sth->fetchrow_arrayref ) {
>     #...
>   }
> 
>   $sth->finish( );
> }
> 
> 
Great idea! 

> See perldoc DBI for more info on placeholders.  Also check out the trace()
> method
> which can be handy to see exactly what you're sending back and forth to
> your DB
> backend.

Digging for info on trace(). Thanks for the info. 
> 
-- 
James P. Kinney III          \Changing the mobile computing world/
CEO & Director of Engineering \          one Linux user         /
Local Net Solutions,LLC        \           at a time.          /
770-493-8244                    \.___________________________./
<a  rel="nofollow" href="http://www.localnetsolutions.com";>http://www.localnetsolutions.com</a>

GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics)
&lt;jkinney at localnetsolutions.com&gt;
Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part



</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="01242" href="msg01242.html">[ale] brain damaged perl DBI</a></strong>
<ul><li><em>From:</em> jkinney at localnetsolutions.com (James P. Kinney III)</li></ul></li>
<li><strong><a name="01253" href="msg01253.html">[ale] brain damaged perl DBI</a></strong>
<ul><li><em>From:</em> esoteric at 3times25.net (Geoffrey)</li></ul></li>
<li><strong><a name="01270" href="msg01270.html">[ale] brain damaged perl DBI</a></strong>
<ul><li><em>From:</em> fletch at phydeaux.org (fletch at phydeaux.org)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg01275.html">[ale] Py[h]hon syntax (sic)</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg01277.html">[ale] Py[h]hon syntax (sic)</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg01270.html">[ale] brain damaged perl DBI</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg01263.html">[ale] Py[h]hon syntax (sic)</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#01276"><strong>Date</strong></a></li>
<li><a href="threads.html#01276"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>