Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: BLK API for DBD::Sybase...
Date: Jul 10 2004 6:13AM

On Fri, 2004-07-09 at 21:15, Edward J. Sabol wrote:
> > The way I see it I have two choices:
> > 1. Store the rowcount somewhere (e.g. $sth->{syb_bcp_rows_affected})
> > or
> > 2. Don't use commit/rollback/finish, and instead create an ad-hoc
> > private method ($sth->syb_bcp_commit(\$rows), etc).
> I think I would vote for (1), but could you post code snippets of each being
> used? I'm not sure I follow exactly, and concrete code to look at would help
> a lot. I suspect that the commit/rollback/finish methods would be the least
> surprising. How would $sth->{syb_bcp_rows_affected} relate to $sth->rows?

Option 1) might look like this in perl:

my $sth = $dbh->prepare("insert ...", {syb_bcp_attribs => ...});
$dbh->commit;      # Note that commit() is a $dbh method, not an $sth
                   # method!
print "$sth->{syb_bcp_rows_affected} rows loaded\n";
# I haven't looked at getting this data into $dbh->rows - it may be
# possible

Option 2) would be something like:

my $sth = $dbh->prepare("insert ...", {syb_bcp_attribs => ...});
my $rows;
print "$rows rows loaded\n";

The fact that commit() is a dbh method is what threw me a little bit,
because it means mixing methods from both handles.

Michael Peppler                              Data Migrations, Inc.             
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short
or long term contract positions -