Yes, placeholders will help your code structure a lot. a simple example...
my $sth_md5=$dbh->prepare("SELECT MD5(concat(?,?,?,?))");
...
...
$rv = $sth_md5->execute($computer,$share,$fullpath,$entry);
based on a scanning script i have, this computes the md5 sum based on 4 variables. (You would probably want to ue Digest::MD5, but this works for an example) I can also use this multiple times over with different variables before ->finishing.
However i note that you're only doing this once, so if performance is an issue, "do" is the way to go. Its just placeholders can make code a little cleaner sometimes
Second, try running debug level 2. i find thats the minimum debug i need to see the queries go in and figure out whats really going on.
Finally, i notice you open 2 connections to the databae without disconnecting the first one. Are you doing this on purpose or for a reason?
Update: Just reminded...heh... one of my biggest problems was DBI inserting as the wrong type - aka inserting without ''s because it thought it was an int, etc. using -> bind_params might be your best bet. The best way to find out if this is the case is to set debug level to 2, and see the query its auctally pasing in ^_^
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.