cvs: pear /MDB2 MDB2.php
| From: | Lukas Smith | Date: | Fri, 17 Mar 2006 17:28:50 +0000 |
| Subject: | cvs: pear /MDB2 MDB2.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-39160@lists.php.net to get a copy of this message | ||
lsmith Fri Mar 17 17:28:50 2006 UTC
Modified files:
/pear/MDB2 MDB2.php
Log:
- added bindValue() method
http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2.php?r1=1.175&r2=1.176&diff_format=u
Index: pear/MDB2/MDB2.php
diff -u pear/MDB2/MDB2.php:1.175 pear/MDB2/MDB2.php:1.176
--- pear/MDB2/MDB2.php:1.175 Fri Mar 17 08:47:03 2006
+++ pear/MDB2/MDB2.php Fri Mar 17 17:28:50 2006
@@ -43,7 +43,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
-// $Id: MDB2.php,v 1.175 2006/03/17 08:47:03 lsmith Exp $
+// $Id: MDB2.php,v 1.176 2006/03/17 17:28:50 lsmith Exp $
//
/**
@@ -3222,7 +3222,7 @@
}
// }}}
- // {{{ bindParam()
+ // {{{ bindValue()
/**
* Set the value of a parameter of a prepared query.
@@ -3235,6 +3235,35 @@
* @return mixed MDB2_OK on success, a MDB2 error on failure
* @access public
*/
+ function bindValue($parameter, &$value, $type = null)
+ {
+ if (!is_numeric($parameter)) {
+ $parameter = preg_replace('/^:(.*)$/', '\\1', $parameter);
+ }
+ if (!array_key_exists($parameter, $this->positions)) {
+ return $this->db->raiseError();
+ }
+ $this->values[$parameter] = $value;
+ if (!is_null($type)) {
+ $this->types[$parameter] = $type;
+ }
+ return MDB2_OK;
+ }
+
+ // }}}
+ // {{{ bindParam()
+
+ /**
+ * Bind a variable to a parameter of a prepared query.
+ *
+ * @param int $parameter the order number of the parameter in the query
+ * statement. The order number of the first parameter is 1.
+ * @param mixed $value variable that is meant to be bound to specified
+ * parameter. The type of the value depends on the $type argument.
+ * @param string $type specifies the type of the field
+ * @return mixed MDB2_OK on success, a MDB2 error on failure
+ * @access public
+ */
function bindParam($parameter, &$value, $type = null)
{
if (!is_numeric($parameter)) {