|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Problem with ct_fetchable function
Date: Oct 5 2000 2:19PM
Arnaud Fileaux writes:
> Hello,
>
> I have a strange problem with ct_fetchable function on my system :
> - Adaptive Server Enterprise/11.9.2.2
> - RedHat 6.1
> - Perl 5.005_03
> - Adaptive Server Enterprise/11.9.2.2
> - Sybperl 2.12.
>
> When i run this query => "select * from logaccess where 1=0" from sqsh
> i
> obtain this result :
>
> 1> select * from logaccess where 1=0
> 2> go
> ticket date heure operation
> ------------------------- -------- -------- --------------------
>
> (0 rows affected)
>
> but with sybperl for the same query ct_fetchable() return CS_ROW_RESULT
> but
> there is no result. And it's the same for all my queries with no result.
> I don't know why ? Perharps i'm missing something with the configuration
> of ASE or sybperl ?
No.
You are seeing the exact same behaviour.
sqsh does this (in terms of perl code):
$dbh->ct_execute(...);
while($dbh->ct_results($restype) == CS_SUCCEED) {
next unless $dbh->ct_fetchable($restype); # ignore non-data results
# get the column names, and print them out
@cols = $dbh->ct_col_names;
print "@cols\n";
foreach (@cols) {
print "--------- ";
}
print "\n";
while(@data = $dbh->ct_fetch) {
print "@data\n";
}
}
In the case of a query that returns no data (no rows) the column names
still get printed. The *result set* for the rows exists, but it is
empty.
Is that a little clearer?
Michael
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@peppler.org -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com
|