Re: DB_Nestedset, quoteIdentifier and Oracle

From: Date: Fri, 25 Nov 2005 19:42:32 +0000
Subject: Re: DB_Nestedset, quoteIdentifier and Oracle
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-40516@lists.php.net to get a copy of this message
On 11/25/05, Olivier Mansour <omansour@gmail.com> wrote: > > Le 24 nov. 05 à 22:13, Justin Patrin a écrit : > > > On 11/24/05, Olivier Mansour <omansour@gmail.com> wrote: > >> Hello All, > >> > >> (please apologize for my english) > >> I'am testing DB_Nestedset with an Oracle database and done two few > >> changes to make it work > >> > >> 1/ patch for DB_Nestedset 1.3.6 > >> > >> ligne 975 > >> replace : $parent['norder'] = is_null($tmp_order) ? 0 : $tmp_order; > >> by : $parent['norder'] = (is_null($tmp_order) or empty($tmp_order)) ? > >> 0 : $tmp_order; > > > > Won't anything that is_null() also be empty()? > > > >> > >> 2/ why in the DB/oci8.php file there is no quoteIdentifier method ? > >> I propose : > >> > >> function quoteIdentifier ($str) { > >> return ($str); > >> } > >> because Oracle dont want identifier to be quoted. > >> > > > > Actually Oracle *does* support/want identifiers to be quoted. I'm the > > one who added this functionality to DB and I've used it myself many > > times. Oracle identifiers are quoted with double quotes. Since this is > > the way that common.php implements quoteIdentifier() oci8.php doesn't > > have to supply its own. If you're having a problem with quoting let us > > know what version of oracle it is and what package is causing the > > problem. If your version of oracle doesn't support quoting there > > *should* be a way to turn it off in your package. Another solution > > would be to create your own DB driver which extends oci8 and defines a > > "null" quoteIdentifier. > > > I am using DB_Nestedset (not my own package) with Oracle 10g > those insert query are generated : > INSERT INTO table ("field1", "field2") VALUES ('toto', > 'tata'); > It should be INSERT INTO table (field1, field2) VALUES ('toto', 'tata'); > No. Oracle 10 certainly supports quoting of identifiers. Is this SQL giving you an error? I sincerely doubt that oracle would have a problem like this with quoting of fields. In fact, to be fully correct the table name should also be quoted here, > DB_Nestedset use quoteidentier to quote field1 .... (function > _values2InsertQuery) but maybe it is'nt the good function to use ? > quoteIdentifier is the right function to use here. > thanks > Olivier > > > > > -- > > Justin Patrin > > -- > PEAR Development Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Justin Patrin

« previous php.pear.dev (#40516) next »