pysome has asked for the wisdom of the Perl Monks concerning the following question:
My Code is following:
where is it wrong? Thanks$dbh = DBI->connect("dbi:sqlite:server=xxx;database=test","","") or di +e "$DBI::errstr\n"; $sth = $dbh->prepare(qq{select id,town from town}); my($id,$name,$n); $sth->execute() or die "error $DBI::errstr\n"; $sth->bind_columns(undef, \$id, \$name); while ($sth->fetch) { $dbh->do("insert into record(id,name) values ($id,'$name')") or die +"can't insert into record\n"; $sth->commit if $n++ % 1000; ## the xxx error point to here,but i r +eally don't know if it is a error } $sth->commit if $n $sth->finish; $dbh->disconnect;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Cant' commit transaction???
by jZed (Prior) on Aug 17, 2007 at 05:52 UTC | |
|
Re: Cant' commit transaction???
by roboticus (Chancellor) on Aug 17, 2007 at 11:30 UTC |