Home » Database » DB » Bug #5646
mssql tableInfo() needs [] for tables with reserved words as name
Details
| Submitted | 2005-10-10 19:28 UTC |
|---|---|
| From | wabut at yahoo dot com |
| Assigned | danielc |
| Status | Wont fix |
| Package | DB |
| PHP Version | 5.0.3 |
| OS | WinXP |
| Roadmaps | (Not assigned) |
Comments
[2005-10-10 19:28 UTC] wabut at yahoo dot com
Description:
------------
db.php v1.7.6
mssql.php v1.83
If tableinfo() takes in a string $result that also happens to be a reserved word, a db_error will result.
in mssql.php on lines 749 and 750 in function tableInfo()
$id = @mssql_query("SELECT * FROM $result WHERE 1=0",
$this->connection);
modified to use [] around the $result
$id = @mssql_query("SELECT * FROM [$result] WHERE 1=0",
$this->connection);
[2005-11-21 23:11 UTC] wabut at yahoo dot com
This breaks the database abstraction though. As much as I'd like to go back in time and tell the dba to change the table name to something else, I can't.
I have a legacy oracle database with a "User" table that I've ported to mysql (where "User" isn't a reserved word) and mssql where "User" is a reserved word.
Switching it to tableinfo('[using names that need delimiting is bad]') breaks the mysql implementation.