|
|
sybperl-l Archive
Up Prev Next
From: Arnaud Fileaux <Arnaud dot Fileaux at teletec dot net>
Subject: Problem with ct_fetchable function
Date: Oct 5 2000 1:29PM
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 ?
Cordially
Arnaud Fileaux
P.S. : my perl script is below :
------------------------------------------------------------------------------------
#!/usr/bin/perl
use Sybase::CTlib;
$login = "test_user";
$password = "mypass";
$db_serveur = "lc2000";
$base = "ap";
$requete = "select * from logaccess where 1 = 0";
$items = "";
@dat = ();
$restype = 0;
print "CS_CMD_SUCCEED: ", CS_CMD_SUCCEED, "\n";
print "CS_SUCCEED: ", CS_SUCCEED, "\n";
print "CS_CMD_DONE: ", CS_CMD_DONE, "\n";
print "CS_CMD_FAIL: ", CS_CMD_FAIL, "\n";
print "CS_ROW_RESULT: ", CS_ROW_RESULT, "\n";
$DB = new Sybase::CTlib $login, $password, $db_serveur;
$DB->ct_sql("use ".$base);
$DB->ct_execute($requete) || die "Exécution de la requête échouée !\n";
while($DB->ct_results($restype) == CS_SUCCEED)
{
if($DB->ct_fetchable($restype)) {
print "There are results.\n";
}
else {
print "No result for this query.\n";
}
print "restype = ", $restype,"\n";
next unless $DB->ct_fetchable($restype);
while(@dat = $DB->ct_fetch)
{
print "-> $dat[0] $dat[1] $dat[2] $dat[3] $dat[4] $dat[5]\n";
}
}
-------------------------------------------------------------------------------------
After run it i have :
[test@caliban portweb]$ ./test_sybase.pl
CS_CMD_SUCCEED: 4047
CS_SUCCEED: 1
CS_CMD_DONE: 4046
CS_CMD_FAIL: 4048
CS_ROW_RESULT: 4040
There are results.
restype = 4040
No result for this query.
restype = 4046
[test@caliban portweb]$
--
o--------------------------------------------------------------------o
Arnaud Fileaux Tél : (33) 02-99-44-16-20 Fax : (33) 02-99-44-15-04
TELETEC S.A. La Fontaine 35150 Corps-Nuds FRANCE
o--------------------------------------------------------------------o
|