############################################################
my $csv_fh = Tie::Handle::CSV->new(
csv_parser => Text::CSV_XS->new( {allow_whitespace => 1} ),
file => $unpackedname,
simple_reads => 1
);
$dbh->do("BEGIN;");
my $sth = $dbh->prepare(
"REPLACE INTO orders ( orderid, volume, price ) "
. " VALUES(?,?,?);"
);
while (my $order = <$csv_fh>) {
$sth->execute(
$order->{orderid}, $order->{volremain}, $order->{price}
);
}
close $csv_fh;
$dbh->do("END;");
############################################################
####
############################################################
my $csv_fh = Tie::Handle::CSV->new(
csv_parser => Text::CSV_XS->new( {allow_whitespace => 1} ),
file => $unpackedname,
simple_reads => 1
);
$dbh->do("BEGIN;");
my $sth = $dbh->prepare(
"REPLACE INTO orders ( orderid, volume, price ) "
. " VALUES(?,?,?);"
);
my $insert_count = 0;
while (my $order = <$csv_fh>) {
$sth->bind_param_array(
++$insert_count,
[ $order->{orderid}, $order->{volremain}, $order->{price} ]
);
}
close $csv_fh;
$sth->execute_array( { ArrayTupleStatus => \my @tuple_status } );
$dbh->do("END;");
############################################################
####
DBD::SQLite::st execute_array failed:
84490 bind values supplied but 3 expected