--- trunk/index_DBI.pm 2003/02/22 21:37:25 18 +++ trunk/index_DBI.pm 2003/02/22 23:47:15 19 @@ -31,15 +31,18 @@ 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), @@ -48,9 +51,11 @@ 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; }