sub bcpInsert { my ($table, $_rows) = @_; my $bcp = new Sybase::CTlib $user, $pass, $server, undef, {CON_PROPS => {CS_BULK_LOGIN => CS_TRUE}}; $bcp -> blk_init($table, $#{@$_rows[0]}, 0, 0); # perform the db upload my $count; my $rows; my $totrows = 0; foreach my $row (@$_rows) { $bcp -> blk_rowxfer($row); $bcp -> blk_done(CS_BLK_BATCH, $rows) unless (++$count % 100); # commit every 100 rows if($rows != 100) { warn "blk_done(BATCH) only committed $rows rows"; } $tot_rows += $rows; } $bcp -> blk_done(CS_BLK_ALL, $rows); # commit the last batch of data $tot_rows += $rows; $bcp -> blk_drop; warn "Debugging: bcpInsert loaded $tot_rows rows\n"; warn "Debugging: bcpInsert returning ..\n"; }