Sybase query result problem
| From: | Paul Moosman | Date: | Wed, 20 Jun 2001 03:54:34 +0000 |
| Subject: | Sybase query result problem | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-57327@lists.php.net to get a copy of this message | ||
I think there is a bug in the PHP sybase_ct module.
The following script produces the following error the second time
getAppName/sybase_fetch_row is called.
Error (warning):
/users/pmoosman/test_data/test1.php(26) : Warning - 3 is not a valid Sybase result
resource
Script:
<?php
function getConnect()
{
$db = sybase_connect('xxxx','yyy','zzz');
return $db;
}
function getAppName($app_id)
{
// static $db;
$sql = "select name from web_apps where application_id=$app_id";
$db = getconnect();
$result = sybase_query($sql, $db);
$row = sybase_fetch_row($result);
return $row[0];
}
getAppName(23);
getAppName(23);
?>
Note: If I uncomment the "static $db" line, the error (warning) goes away.
I ran this script through the debugger and it looks like the db resource
handle is getting incorrectly cleaned up.
I compared php_sybase_ct.c to php_mysql.c and I noticed that php_mysql.c ups
the reference count on db resource link and php_sybase_ct.c does not. So,
my guess is that that is the problem. However, I'm new to PHP and I'm not
very familiar with the Zend code, so I would appreciate someone with some Zend
knowledge to look over my proposed fix.
In my copy of php_sybase_ct.c version 1.43 I added the following two lines:
Line #599: zend_list_addref(link);
Line #638: zend_list_addref(SybCtG(default_link));
Any help would be appreciated.
--
Paul Moosman
PWMoosman@aol.com