in reply to DBI won't let go!

The problem is that I cannot rename, move or unlink the file. When I remove all of the DBI related stuff I can. Someone please to explain this?

Not with the (lack of) information that you've provided, though I have a suspicion. Add some error checking, and report out the error.   rename($_, "Processed/$_") or die "$_: $!"; Also, add error checking to your DBI calls. And I suspect that your UPDATE query isn't doing what you expect it do.

Replies are listed 'Best First'.
Re: Re: DBI won't let go!
by UnderMine (Friar) on Dec 06, 2002 at 21:12 UTC
    I think that dws and I have the same suspicions (I may be wrong). If you are going to the extent of doing a prepare then reuse it. Try :-
    my $dbh = DBI->connect('Blah', 'Blah', 'Blah', 'Blah'); $dbh->{LongReadLen} = 65535; my $stmt = $dbh->prepare(" UPDATE Images SET Name = ?" ); for my $file (@JpgList){ my $rv; $rv = $stmt->execute or die $stmt->errstr; $stmt->execute($file); rename("$_","Processed/$_"); } $stmt->finish; $dbh->disconnect;
    "execute"
    $rv = $sth->execute or die $sth->errstr;
    $rv = $sth->execute(@bind_values) or die $sth->errstr;

    Perform whatever processing is necessary to execute the prepared statement. An "undef" is returned if an error occurs. A successful "execute" always returns true regardless of the number of rows affected, even if it's zero (see below). It is always important to check the return status of "execute" (and most other DBI methods) for errors.

    For a non-"SELECT" statement, "execute" returns the number of rows affected, if known. If no rows were affected, then "execute" returns "0E0", which Perl will treat as 0 but will regard as true. Note that it is not an error for no rows to be affected by a statement. If the number of rows affected is not known, then "execute" returns -1.

    PS do you really want to do an unconstrained update to the images table?

    Hope it helps
    UnderMine