cvs: pear /MDB2 package_mysql.php package_mysqli.php /MDB2/MDB2/Driver/Manager mysql.php mysqli.php
| From: | Lorenzo Alberton | Date: | Fri, 16 Feb 2007 15:51:15 +0000 |
| Subject: | cvs: pear /MDB2 package_mysql.php package_mysqli.php /MDB2/MDB2/Driver/Manager mysql.php mysqli.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44685@lists.php.net to get a copy of this message | ||
quipo Fri Feb 16 15:51:15 2007 UTC
Modified files:
/pear/MDB2/MDB2/Driver/Manager mysql.php mysqli.php
/pear/MDB2 package_mysql.php package_mysqli.php
Log:
fixed bug #10057: createConstraint() returns an error when the definition is incomplete
http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Manager/mysql.php?r1=1.90&r2=1.91&diff_format=u
Index: pear/MDB2/MDB2/Driver/Manager/mysql.php
diff -u pear/MDB2/MDB2/Driver/Manager/mysql.php:1.90 pear/MDB2/MDB2/Driver/Manager/mysql.php:1.91
--- pear/MDB2/MDB2/Driver/Manager/mysql.php:1.90 Sat Dec 9 22:18:43 2006
+++ pear/MDB2/MDB2/Driver/Manager/mysql.php Fri Feb 16 15:51:15 2007
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
-// $Id: mysql.php,v 1.90 2006/12/09 22:18:43 quipo Exp $
+// $Id: mysql.php,v 1.91 2007/02/16 15:51:15 quipo Exp $
//
require_once 'MDB2/Driver/Manager/Common.php';
@@ -154,6 +154,7 @@
if (PEAR::isError($db)) {
return $db;
}
+
$query = $this->_getCreateTableQuery($name, $fields, $options);
if (PEAR::isError($query)) {
return $query;
@@ -689,22 +690,22 @@
/**
* create a constraint on a table
*
- * @param string $table name of the table on which the constraint is to be created
+ * @param string $table name of the table on which the constraint is to be created
* @param string $name name of the constraint to be created
- * @param array $definition associative array that defines properties of the
constraint to be created.
- * Currently, only one property named FIELDS is supported. This
property
- * is also an associative with the names of the constraint
fields as array
- * constraints. Each entry of this array is set to another type
of associative
- * array that specifies properties of the constraint that are
specific to
- * each field.
- *
- * Example
- * array(
- * 'fields' => array(
- * 'user_name' => array(),
- * 'last_login' => array()
- * )
- * )
+ * @param array $definition associative array that defines properties of the constraint
to be created.
+ * Currently, only one property named FIELDS is supported. This
property
+ * is also an associative with the names of the constraint
fields as array
+ * constraints. Each entry of this array is set to another type
of associative
+ * array that specifies properties of the constraint that are
specific to
+ * each field.
+ *
+ * Example
+ * array(
+ * 'fields' => array(
+ * 'user_name' => array(),
+ * 'last_login' => array()
+ * )
+ * )
* @return mixed MDB2_OK on success, a MDB2 error on failure
* @access public
*/
@@ -723,6 +724,10 @@
} elseif (!empty($definition['unique'])) {
$type = 'UNIQUE';
}
+ if (empty($type)) {
+ return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
+ 'invalid definition, could not create constraint', __FUNCTION__);
+ }
$table = $db->quoteIdentifier($table, true);
$query = "ALTER TABLE $table ADD $type $name";
http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Manager/mysqli.php?r1=1.77&r2=1.78&diff_format=u
Index: pear/MDB2/MDB2/Driver/Manager/mysqli.php
diff -u pear/MDB2/MDB2/Driver/Manager/mysqli.php:1.77 pear/MDB2/MDB2/Driver/Manager/mysqli.php:1.78
--- pear/MDB2/MDB2/Driver/Manager/mysqli.php:1.77 Sat Dec 9 22:18:43 2006
+++ pear/MDB2/MDB2/Driver/Manager/mysqli.php Fri Feb 16 15:51:15 2007
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
-// $Id: mysqli.php,v 1.77 2006/12/09 22:18:43 quipo Exp $
+// $Id: mysqli.php,v 1.78 2007/02/16 15:51:15 quipo Exp $
//
require_once 'MDB2/Driver/Manager/Common.php';
@@ -724,6 +724,10 @@
} elseif (!empty($definition['unique'])) {
$type = 'UNIQUE';
}
+ if (empty($type)) {
+ return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
+ 'invalid definition, could not create constraint', __FUNCTION__);
+ }
$table = $db->quoteIdentifier($table, true);
$query = "ALTER TABLE $table ADD $type $name";
http://cvs.php.net/viewvc.cgi/pear/MDB2/package_mysql.php?r1=1.94&r2=1.95&diff_format=u
Index: pear/MDB2/package_mysql.php
diff -u pear/MDB2/package_mysql.php:1.94 pear/MDB2/package_mysql.php:1.95
--- pear/MDB2/package_mysql.php:1.94 Thu Feb 8 09:40:10 2007
+++ pear/MDB2/package_mysql.php Fri Feb 16 15:51:15 2007
@@ -15,6 +15,7 @@
- added error codes for MySQL 5 (patch by Adam Harvey)
- implemented guid() in the Function module [globally unique identifier]
- fixed bug #10033: beginTransaction() does not know server capabilities
+- fixed bug #10057: createConstraint() returns an error when the definition is incomplete
- phpdoc fixes
note:
http://cvs.php.net/viewvc.cgi/pear/MDB2/package_mysqli.php?r1=1.97&r2=1.98&diff_format=u
Index: pear/MDB2/package_mysqli.php
diff -u pear/MDB2/package_mysqli.php:1.97 pear/MDB2/package_mysqli.php:1.98
--- pear/MDB2/package_mysqli.php:1.97 Thu Feb 8 09:40:10 2007
+++ pear/MDB2/package_mysqli.php Fri Feb 16 15:51:15 2007
@@ -15,6 +15,7 @@
- added error codes for MySQL 5 (patch by Adam Harvey)
- implemented guid() in the Function module [globally unique identifier]
- fixed bug #10033: beginTransaction() does not know server capabilities
+- fixed bug #10057: createConstraint() returns an error when the definition is incomplete
- phpdoc fixes
open todo items: