[PHP-DEV] PHP 4.0 Bug #5756 Updated: Invalid sybase connections appearing From: Bug Database (php-dev <email protected>)
Date: 10/15/00

ID: 5756
Updated by: lyric
Reported By: dclark <email protected>
Status: Closed
Bug Type: Sybase-ct (ctlib) related
Assigned To: lyric
Comments:

Duplicate of bug 5705. Fixed in CVS 2000/07/20.

Previous Comments:
---------------------------------------------------------------------------

[2000-08-23 08:54:05] sniper <email protected>
Maybe you'll remember this bug now, lyric? =)

---------------------------------------------------------------------------

[2000-07-24 23:30:59] lyric <email protected>
The code as written will not even give you that. If you're posting a bug report, please cut'n'paste the sample code - we can't help if you don't describe your problem properly :)

Anyway, your code is broken :
 - the for loop should be seperated by ; not ,
 - The parameter to sybase_fetch_row() should be $result not $row

Your problem is that sybase_select_db fails every second time. I'm looking at why now.

---------------------------------------------------------------------------

[2000-07-24 13:00:44] dclark <email protected>

 The following code produces some odd behaviour with respect to sybase connections.

 for ($i=0,$i<10,$i++) {
1. $link = sybase_connect("x","x","x");
2. echo "Link ID = $link -- ";
3. sybase_select_db("x");
4. $result = sybase_query("select ...");
5. echo "Result ID = $result";
6. $row = sybase_fetch_row($row);
7. echo "query result = $row[0]";
8. echo "------------- <br>";
 }

This code gives me the following output:
Link ID = Resource id#1 -- Result ID = Resource id#2
query result = x
-------------
Link ID = Resource id#1 --
Warning 1 is not a valid Sybase-Link resource in line 3
Warning 1 is not a valid Sybase-Link resource in line 4
Result ID =
Warning Supplied argument is not a valid Sybase result resource in line 6
query result =
--------------
The above pattern repeats itself with the Link ID now Resource id#3 and Result ID = Resource id#4, etc

Removing Lines 6 and 7 gives :
Link ID = Resource id#1 -- Result ID = Resource id#2
Link ID = Resource id#1 -- Result ID = Resource id#3
Link ID = Resource id#4 -- Result ID = Resource id#5
Link ID = Resource id#4 -- Result ID = Resource id#6
Link ID = Resource id#7 -- Result ID = Resource id#8
Link ID = Resource id#7 -- Result ID = Resource id#9
etc

Adding a sybase_close fixes the problems
Link ID = Resource id#1 -- Result ID = Resource id#2
Link ID = Resource id#3 -- Result ID = Resource id#4
Link ID = Resource id#5 -- Result ID = Resource id#6

PHP modules: --with-apache (1.3.12)
             --with-sybase-ct (11.0.0.3)
             --enable-trans-sid

PHP.ini : default except for sybase severity errors on 11

Hope this helps
Thanks
David Clark

---------------------------------------------------------------------------

Full Bug description available at: http://bugs.php.net/?id=5756

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>