cvs: php4 /pear/DB mysql.php
| From: | Thomas V.V.Cox | Date: | Sat, 14 Jul 2001 20:02:53 +0000 |
| Subject: | cvs: php4 /pear/DB mysql.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-275@lists.php.net to get a copy of this message | ||
cox Sat Jul 14 16:02:53 2001 EDT
Modified files:
/php4/pear/DB mysql.php
Log:
not quote integers in quote()
Index: php4/pear/DB/mysql.php
diff -u php4/pear/DB/mysql.php:1.60 php4/pear/DB/mysql.php:1.61
--- php4/pear/DB/mysql.php:1.60 Thu Jul 12 07:20:08 2001
+++ php4/pear/DB/mysql.php Sat Jul 14 16:02:53 2001
@@ -411,12 +411,28 @@
return $this->query("DROP TABLE ${sqn}_seq");
}
- function quote($string)
+ // }}}
+ // {{{ quote()
+ /**
+ * Quote the given string so it can be safely used within string delimiters
+ * in a query.
+ * @param $string mixed Data to be quoted
+ * @return mixed "NULL" string, quoted string or original data
+ */
+ function quote($str = null)
{
- return ($string === null) ? 'NULL' :
"'".mysql_escape_string($string)."'";
+ switch (strtolower(gettype($str))) {
+ case 'null':
+ return 'NULL';
+ case 'integer':
+ return $str;
+ case 'string':
+ default:
+ return "'".mysql_escape_string($str)."'";
+ }
}
-
// }}}
+
// {{{ modifyQuery()
function modifyQuery($query)