ID:               41244
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mallinger at tc dot edu
-Status:           Open
+Status:           Bogus
 Bug Type:         MSSQL related
 Operating System: Windows 2003 Server
 PHP Version:      5.2.1
 New Comment:

MS SQL server does not allow new queries on the same connection as long
as there are results pending the clients actions. Either fetch all data
or release the result before sending new queries.

Another solution is to have multiple connections. mssql_connect()
supports an optional parameter to force the creation of a new connection
even if host, user and password is the same as for an existing
connection.


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

[2007-04-30 17:58:34] mallinger at tc dot edu

Description:
------------
When executing multiple queries from a single mssql_query call, the
connection is lost and subsequent connections cannot be created.  There
are similar problems documented for PHP4, but it seems that (a) this is
not documented for PHP5; and (b) the inability to create subsequent
connections is not documented.  In particular, it seems the
mssql_select_db is what is failing in the second connection.

Reproduce code:
---------------
$conn = mssql_connect('host', 'user', 'pass');
mssql_select_db("db", $conn);
mssql_query("QUERY 1", $conn);
mssql_query("QUERY 2; QUERY 3; QUERY 4;", $conn);
// this will fail:
mssql_query("QUERY 5", $conn);
// this is ok
mssql_close($conn);
// everything below will fail too:
$conn2 = mssql_connect('host', 'user', 'pass');
mssql_select_db("db", $conn2);
mssql_query("QUERY 6", $conn2);

Expected result:
----------------
The queries should execute with no problems.

Actual result:
--------------
Everything after the multiple query mssql_query call ("QUERY 2; QUERY
3; QUERY 4;" will fail.  New connections fail when trying to select a
database ("mssql_select_db() [function.mssql-select-db]: Unable to
select database:...") and the existing connection cannot be used anymore
("mssql_query() [function.mssql-query]: Query failed in...") .




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


-- 
Edit this bug report at http://bugs.php.net/?id=41244&edit=1

Reply via email to