We use PEAR's DB class as our abstration layer. Here is the connection
function from DB\mssql.php:
function connect($dsninfo, $persistent = false)
{
if (!DB::assertExtension('mssql') &&
!DB::assertExtension('sybase')
&& !DB::assertExtension('sybase_ct'))
{
return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
}
$this->dsn = $dsninfo;
$dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] :
'localhost';
$dbhost .= $dsninfo['port'] ? ',' . $dsninfo['port'] : '';
$connect_function = $persistent ? 'mssql_pconnect' :
'mssql_connect';
if ($dbhost && $dsninfo['username'] && $dsninfo['password']) {
$conn = @$connect_function($dbhost, $dsninfo['username'],
$dsninfo['password']);
} elseif ($dbhost && $dsninfo['username']) {
$conn = @$connect_function($dbhost, $dsninfo['username']);
} else {
$conn = @$connect_function($dbhost);
}
if (!$conn) {
return $this->raiseError(DB_ERROR_CONNECT_FAILED, null,
null,
null,
@mssql_get_last_message());
}
if ($dsninfo['database']) {
if ([EMAIL PROTECTED]($dsninfo['database'], $conn)) {
return $this->raiseError(DB_ERROR_NODBSELECTED, null,
null,
null,
@mssql_get_last_message());
}
$this->_db = $dsninfo['database'];
}
$this->connection = $conn;
return DB_OK;
}
We use the DSN: mssql://UID:[EMAIL PROTECTED]/db_name. We are not using
persistent connections.
thnx,
Chris
________________________________
From: Dan Shirah [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 09, 2007 11:07 AM
To: Chris Boget
Cc: PHP General
Subject: Re: [PHP] Problem with mssql_query()
Post your block of code from your connection string (Leave out your
username/password info please) to the end of the result set for your
query so I can take a look at it.
On 5/9/07, Chris Boget <[EMAIL PROTECTED]> wrote:
I noticed the following in my logs:
22:04:42 [warning] [D:\PHP\pear\DB\mssql.php][439]:
mssql_query(): Unable
to set query
22:04:42 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][439];
function(
mssql_query ); args( 1[value:select @@ERROR as ErrorCode]
2[value:Resource
id #21] )
22:04:42 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][489];
function(
errornative )
22:04:42 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][145];
function(
mssqlraiseerror )
22:04:42 [info] Backtrace: [D:\PHP\pear\DB\common.php][1146];
function(
simplequery ); args( 1[value:SELECT * FROM wording WHERE
wording_id =
'8' ] )
22:04:42 [critical] Error in the following query:<br><br>SELECT
* FROM
wording WHERE wording_id = '8' <br>DB Error: unknown error
22:04:52 [warning] [D:\PHP\pear\DB\mssql.php][439]:
mssql_query(): Unable
to set query
22:04:52 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][439];
function(
mssql_query ); args( 1[value:select @@ERROR as ErrorCode]
2[value:Resource
id #21] )
22:04:52 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][489];
function(
errornative )
22:04:52 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][145];
function(
mssqlraiseerror )
22:04:52 [info] Backtrace: [D:\PHP\pear\DB\common.php][1146];
function(
simplequery ); args( 1[value:SELECT * FROM wording WHERE
wording_id =
'8' ] )
22:04:52 [critical] Error in the following query:<br><br>SELECT
* FROM
wording WHERE wording_id = '8' <br>DB Error: unknown error
Why is mssql_query() saying that it's unable to set the query?
I did some
searching on Google and found that people were having this
problem but that
was back in 2001 using an earlier version of PHP. We are using
version
4.3.11 and Microsoft SQL Server 2000 - 8.00.2039 (Intel X86).
Has anyone had a similar problem? What was your solution? Why
is this
happening?
thnx,
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php