RE: [PEAR-CVS] cvs: pear /DB/DB common.php ibase.php mssql.php mysql.php mysql4.php oci8.php odbc.php pgsql.php sybase.php

From: Date: Fri, 02 Jan 2004 01:42:51 +0000
Subject: RE: [PEAR-CVS] cvs: pear /DB/DB common.php ibase.php mssql.php mysql.php mysql4.php oci8.php odbc.php pgsql.php sybase.php
References: 1  Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-15266@lists.php.net to get a copy of this message
> From: Jon Parise [mailto:jon@php.net] > Sent: Friday, January 02, 2004 2:36 AM > On Fri, Jan 02, 2004 at 08:41:39AM +0800, Alan Knowles wrote: > > > >+ * Quotes a string so it can be safely used in a query. > > >+ * > > >+ * It will return the string with single quotes around. > > >+ * > > >+ * This method gets overridden if the DBMS being used has a > quote() > > >+ * method in its sub-class. Those overriding methods contain > notes > > >+ * about which data types should be used to handle BOOLEAN data in > > >+ * each DBMS. > > > > > It looks like this is not what this method is now doing. > > if the > > > > + if (is_int($str) || is_double($str)) { > > + return $str; > > > > I would expect this to return '$str'; > > .. I asked it to be quoted, but In the above code it didnt get quoted... > > > > I'm not keen to see quote do this much magic, - adding an extra method > > called typequote, or something for this would infer that it does more > > that just quote strings. > > Perhaps there could be a smartquote() method that would invoke quote() > for strings and simply return everything else unmodified. quote() > would always quote and escape its content. > > That would be both clear and consistent, I think. Unfortunately, it > would mean a backward-compatibility break for quote() (which would > lose its magic). BC break is not possible as the next release is not a major version. However maybe an option could be used. However I would say just stick with the current "magic" and not bother adding more datatype handling into DB. Of course I am argueing as the maintainer of MDB. I feel that it doesn't make sense to make half an attempt to add datatype support into DB when you have full support readily available. MDB even has a wrapper for DB (although I haven't tested it in a while I must admit) and even with that wrapper is still was very close in performance (atleast for simple query-fetch tests that I made with John Lims benchmark). MDB2 which is in the final stages of completion is even more similar in terms of the API as DB and is even faster than MDB. Regards, Lukas

« previous php.pear.cvs (#15266) next »