Discussion:
[freetds] rows method with SyBase driver always returns -1
Alan Mosca
2013-03-07 17:35:41 UTC
Permalink
Hello,

I am using the SyBase driver to connect to Sql Server 08 and after an
insert or an update the rows method always returns -1. I have attached a
TDSDUMP, and following is some sample code. Is this a bug or am I doing
something wrong?

Thank you!

--
Alan

#!/usr/bin/perl

my ($user, $pass, $server) = ('user', 'pass', 'server');

use DBI;
require DBD::Sybase;

# New TDS protocol
$ENV{TDSVER} = '8.0';

my $dbh = DBI->connect("dbi:Sybase:$server", $user, $pass,
{ RaiseError => 1,
PrintError => 0,
ShowErrorStatement => 1,
AutoCommit => 1,
FetchHashKeyName => 'NAME_lc',
syb_no_child_con => 1
})
or die "Could not make connection to database: $DBI::errstr";

###ON TEMP DATABASE
$dbh->do("create table #tbTemp (col1 int)");

$dbh->do("insert into #tbTemp values (1)");
#this prints -1
print $dbh->rows . "\n";

$dbh->do("update #tbTemp set col1 = 2 where col1 = 1");
#this prints -1
print $dbh->rows. "\n";

$dbh->do("drop table #tbTemp");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tds_dump.log
Type: application/octet-stream
Size: 48174 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20130307/428f2206/attachment-0001.obj
Loading...