#24496 [Opn->Bgs]: mssql_select_db doesn't accept database names with whitespaces

From: Date: Sat, 05 Jul 2003 21:48:09 +0000
Subject: #24496 [Opn->Bgs]: mssql_select_db doesn't accept database names with whitespaces
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-43308@lists.php.net to get a copy of this message
 ID:               24496
 Updated by:       fmk@php.net
 Reported By:      mheuser at a-tune dot de
-Status:           Open
+Status:           Bogus
 Bug Type:         MSSQL related
 Operating System: Windows 2000 SP4
 PHP Version:      4.3.2
 New Comment:

The MSSQL syntax for handling white spaces in identifiers is to use []
arround the name.

$dbDatabase = "[030616 td@demo mhe]";
// or
$dbDatabase = "[td@demo mhe 030616]";

Will work.



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

[2003-07-04 08:34:32] mheuser at a-tune dot de

Description:
------------
The mssql_select_db function does not accept any whitespaces in the
database name string nor decimal numbers at the front. If I replace the
whitespaces with something else (like _) and cut the numbers out or let
them trail the string, no error occurs and the command is performed
correctly.
The code line given in the error messages at the bottom of this page,
are actually in the PEAR::MDB package. I located the line in the source
code:

if(!mssql_select_db($this->database_name, $this->connection)) {
   return($this->mssqlRaiseError());
}



Reproduce code:
---------------
$dbDatabase = "030616 td@demo mhe";
// or
$dbDatabase = "td@demo mhe 030616";
mssql_select_db($dbDatabase); // Connection to DBMS server was already
made successfully



Expected result:
----------------
I'd expect no error message which means a successfully selected
database.

Actual result:
--------------
// Error message
Warning: mssql_select_db(): message: Zeile 1: Falsche Syntax in der
Nähe von '030616'. (severity 15) in C:\PHP\pear\MDB\mssql.php on line
417

// and for the second example
Warning: mssql_select_db(): message: Zeile 1: Falsche Syntax in der
Nähe von 'mhe'. (severity 15) in C:\PHP\pear\MDB\mssql.php on line 417

In both examples the error occurs when calling mssql_select_db (see
description on top of this page for the source code line).




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


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



Thread (2 messages)

« previous php.bugs (#43308) next »