my $field = shift;
+#print "#### delete_and_create($field)\n";
+
$self->{dbh}->commit;
- $self->{dbh}->begin_work;
my $sql = "select count(*) from $field";
my $sth = $self->{dbh}->prepare($sql) || die $self->{dbh}->errstr();
# FIX: this is not a good way to check if table exists!
if ($sth->execute() && $sth->fetchrow_hashref) {
my $sql = "drop table $field";
+ $self->{dbh}->begin_work;
my $sth = $self->{dbh}->do($sql) || die "SQL: $sql ".$self->{dbh}->errstr();
+ $self->{dbh}->commit;
}
$sql = "create table $field (
item varchar(255),
ord int,
primary key (item,ident)
)";
- $sth = $self->{dbh}->do($sql); # || warn "SQL: $sql ".$self->{dbh}->errstr();
+ $self->{dbh}->begin_work;
+ $sth = $self->{dbh}->do($sql); # || warn "SQL: $sql ".$self->{dbh}->errstr();
$self->{dbh}->commit;
+
$self->{dbh}->begin_work;
}