[Patch] Add support for DB->quoteEntity and Make $__DB = more consistent
| From: | Justin Patrin | Date: | Thu, 11 Dec 2003 08:59:22 +0000 |
| Subject: | [Patch] Add support for DB->quoteEntity and Make $__DB = more consistent | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-24345@lists.php.net to get a copy of this message | ||
This patch adds support to DB_DataObject to quote table and column names
with the DB function quoteEntity(). Note: I just submitted the
quoteEntity patch, so to use this, you must have installed the DB patch.
If the DB patch is altered before submission to CVS, I will alter this
patch accordingly.
This feature is by default off, but can be turned on by setting:
quote_entities = 1
in the DataObject.ini.
All functions which take SQL code directly will not be quoted. They must
be quoted by the user (using DB::quoteEntity() of course). This will
have to be mentioned in the docs. I'm not sure about some of the
functions. selectAdd() is normally used with columns, but may be, say, a
function call, so I removed my quiting code from there. However,
selectAs() looks like it is made for columns, so I left my code in. Is
this correct?
NONE of my code takes into account that the table/column could be
pre-quoted. Technically, this should probably go in the DB function
(although I didn't add it there, either).
While working on this patch, I also noticed that many functions were
getting $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]
directly instead of using getDatabaseConnection, so I changed all that I
could find.
I also found two possible bugs while working on this pertaining to
joinAdd. Bugs 404 and 405.
I have tested my changes with a small test script. If you would like me
to send that, just ask.
--
paperCrane <Justin Patrin>