PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: sy50027 at milton dot sbi dot com (Simon Yaminian)
Subject: Re: Obtaining rowcount when updating
Date: Sep 25 1998 2:29PM

> From owner-SYBPERL-L@listproc.net Thu Sep 24 19:19:51 1998
> From: Michael Peppler 
> Mime-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Date: Thu, 24 Sep 1998 15:51:07 -0700 (PDT)
> To: SybPerl Discussion List 
> Subject: Re: Obtaining rowcount when updating
> X-Listprocessor-Version: 8.2.07 -- ListProc(tm) by CREN
> 
> Simon Yaminian writes:
>  > 
>  > 
>  >    If you notice in my message, I did use DBCOUNT (and not DBROWS - I looked
>  > up both before trying them) and it still produced 0 as the
> rowcount.
> 
> This works for me:
> 
> use Sybase::DBlib;
> 
> my $dbh = new Sybase::DBlib 'sa';
> 
> $dbh->dbcmd("insert testdb..orders values(10, 11, 12)");
> $dbh->dbsqlexec;
> $dbh->dbresults;
> print "Rows = ", $dbh->DBCOUNT, "\n";
> 
> 
> output:
> 
> kiruna (2:08pm):1 > perl insert.pl 
> Rows = 1
> 
> So what does your script look like?
> 
> Michael
> -- 
> Michael Peppler         -||-  Data Migrations Inc.
> mpeppler@mbay.net       -||-  http://www.mbay.net/~mpeppler
> Int. Sybase User Group  -||-  http://www.isug.com
> 
> Thanks for your reply;

   In my scripts, I do $dbh->dbnextrow between the $dbh->dbresults and the
$dbh->DBCOUNT calls and this apparently throws DBCOUNT off. So when I obtain
the DBCOUNT right after the $dbh->dbresults call, it generates the right
rowcount. However, I noticed that DBCOUNT is -1 when the sql call is a 'select'.
In this case doing a $dbh->DBCOUNT after all $dbh->dbnextrow calls are 
exhausted, produces the right row count. Is this normal?

Thanks & Regards
Simon Yaminian