Leser: 16
1 2 3 4 5 6 7 8
my $sql = "SELECT ID FROM User WHERE Status = 'X';"; my $sth = $dbh->prepare($sql); $sth->execute; while ( my $id = $sth->fetchrow_array ) { $dbh->do("DELETE FROM User WHERE ID = $id;"); }
DBD::SQLite::db do failed: database table is locked(1) at dbdimp.c line 402
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
my $sql = "SELECT ID FROM User WHERE Status = 'X';"; my $sth = $dbh->prepare($sql); $sth->execute; my $cnt = 0; while ( my $id = $sth->fetchrow_array ) { if (-e "bilder\\$id.jpg") { system("del /F /Q bilder\\$id.jpg"); } $cnt++; } $dbh->do("DELETE FROM User WHERE Status = 'X';");
system("del /F /Q bilder\\$id.jpg");
unlink("bilder\\$id.jpg");
unlink("bilder\\$id.jpg") or die("ERROR DELETE $id.jpg ($!)");
1 2
my $path=File::Spec->join("bilder","$id.jpg"); unlink($path) or die(qq#ERROR DELETE "$path" ($!)#);