in reply to DBI:mysql

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 ^_^

Replies are listed 'Best First'.
Re: Re: DBI:mysql
by Dalin (Sexton) on Apr 15, 2002 at 13:38 UTC
    Ooops... yeah, I should've been disconnecting that first one. I set the trace to level 2 and that is helping somewhat. I did the bind_param on the data...
    for (my $i = 1;$i <= $count;++$i) { if ( $values[$i -1] =~ /\d+ ) { $insert00->bind_param($i,$values[$i - 1],SQL_INTEGER); }else{ $insert00->bind_param($i,$values[$i - 1]); }
    But I get the same results.