Re: cvs: pear /DB/DB common.php ibase.php mssql.php mysql.php mysql4.php oci8.php odbc.php pgsql.php sybase.php
| From: | Jon Parise | Date: | Fri, 02 Jan 2004 01:35:43 +0000 |
| Subject: | Re: cvs: pear /DB/DB common.php ibase.php mssql.php mysql.php mysql4.php oci8.php odbc.php pgsql.php sybase.php | ||
| References: | 1 2 | Groups: | php.pear.cvs |
| Request: | Send a blank email to pear-cvs+get-15263@lists.php.net to get a copy of this message | ||
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).
--
Jon Parise (jon@php.net) :: The PHP Project (http://www.php.net/)