Topic: MSSQLNative and MultipleActiveResultSets
author: Bill Thousand
created: 30-04-2012 09:48:06 AM
|
We have been experimenting with the new MSSQLNative driver and have determined that we need to add the parameter 'MultipleActiveResultSets'=>'0' to the connection info in order to get our application to be compatible.
In order to get that to work, I changed it in the driver code.
Is there some better way to get this into the connection info?
Thanks! |
|
Topic: Re:MSSQLNative and MultipleActiveResultSets
author: John Lim
created: 01-05-2012 11:37:58 PM
|
Hi, Can i have your code modifications. TQ, John |
|
Topic: Re:MSSQLNative and MultipleActiveResultSets
author: John Lim
created: 01-05-2012 11:44:43 PM
|
Never mind. I figured it out. I have changed code to work as follows. Call this before you connect:
$db->connectionInfo['MultipleActiveResultSets'] = 0;
$db->Connect($host, $userid, $pwd, $db);
To implement, add following variable to the adodb-mssqlnative connection class:
var $connectionInfo = array();
Then in the connect function you define:
function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
{
if (!function_exists('sqlsrv_connect')) return null;
$connectionInfo = $this->connectionInfo;
$connectionInfo["Database"]=$argDatabasename;
$connectionInfo["UID"]=$argUsername;
$connectionInfo["PWD"]=$argPassword;
if ($this->debug) error_log("<hr>connecting... hostname: $argHostname params: ".var_export($connectionInfo,true));
//if ($this->debug) error_log("<hr>_connectionID before: ".serialize($this->_connectionID));
if(!($this->_connectionID = sqlsrv_connect($argHostname,$connectionInfo))) {
if ($this->debug) error_log( "<hr><b>errors</b>: ".print_r( sqlsrv_errors(), true));
return false;
}
//if ($this->debug) error_log(" _connectionID after: ".serialize($this->_connectionID));
//if ($this->debug) error_log("<hr>defined functions: <pre>".var_export(get_defined_functions(),true)."</pre>");
return true;
} |
|
Topic: Re:MSSQLNative and MultipleActiveResultSets
author: Bill Thousand
created: 03-05-2012 02:43:39 PM
|
Thanks John. That works great! |
|
|