cvs: pear /MDB2_Schema/MDB2 Schema.php
| From: | Lukas Smith | Date: | Thu, 15 Dec 2005 22:53:09 +0000 |
| Subject: | cvs: pear /MDB2_Schema/MDB2 Schema.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-36889@lists.php.net to get a copy of this message | ||
lsmith Thu Dec 15 22:53:09 2005 EDT
Modified files:
/pear/MDB2_Schema/MDB2 Schema.php
Log:
- ensure that all primary/unique/foreign key handling is only in the contraint methods
http://cvs.php.net/viewcvs.cgi/pear/MDB2_Schema/MDB2/Schema.php?r1=1.47&r2=1.48&diff_format=u
Index: pear/MDB2_Schema/MDB2/Schema.php
diff -u pear/MDB2_Schema/MDB2/Schema.php:1.47 pear/MDB2_Schema/MDB2/Schema.php:1.48
--- pear/MDB2_Schema/MDB2/Schema.php:1.47 Thu Dec 15 03:12:15 2005
+++ pear/MDB2_Schema/MDB2/Schema.php Thu Dec 15 22:53:08 2005
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
-// $Id: Schema.php,v 1.47 2005/12/15 03:12:15 dufuz Exp $
+// $Id: Schema.php,v 1.48 2005/12/15 22:53:08 lsmith Exp $
//
require_once 'MDB2.php';
@@ -468,7 +468,7 @@
foreach ($indexes as $index_name => $index) {
$errorcodes = array(MDB2_ERROR_UNSUPPORTED, MDB2_ERROR_NOT_CAPABLE);
$this->db->expectError($errorcodes);
- if (array_key_exists('primary', $index)) {
+ if (array_key_exists('primary', $index) ||
array_key_exists('unique', $index)) {
$indexes = $this->db->manager->listTableConstraints($table_name);
} else {
$indexes = $this->db->manager->listTableIndexes($table_name);
@@ -483,7 +483,7 @@
$this->db->debug('Index already exists: '.$index_name);
return MDB2_OK;
}
- if (array_key_exists('primary', $index)) {
+ if (array_key_exists('primary', $index) ||
array_key_exists('unique', $index)) {
$result = $this->db->manager->dropConstraint($table_name,
$index_name);
} else {
$result = $this->db->manager->dropIndex($table_name, $index_name);
@@ -518,7 +518,7 @@
$this->db->manager->alterTable($table_name, $changes, false);
}
- if (array_key_exists('primary', $index)) {
+ if (array_key_exists('primary', $index) ||
array_key_exists('unique', $index)) {
$result = $this->db->manager->createConstraint($table_name, $index_name,
$index);
} else {
$result = $this->db->manager->createIndex($table_name, $index_name,
$index);
@@ -1325,7 +1325,7 @@
if (array_key_exists('change', $changes)) {
foreach ($changes['change'] as $index_name => $index) {
- if (array_key_exists('primary', $index)) {
+ if (array_key_exists('primary', $index) ||
array_key_exists('unique', $index)) {
$result = $this->db->manager->createConstraint($table_name,
$index_name, $index);
} else {
$result = $this->db->manager->createIndex($table_name, $index_name,
$index);
@@ -1338,7 +1338,7 @@
}
if (array_key_exists('add', $changes)) {
foreach ($changes['add'] as $index_name => $index) {
- if (array_key_exists('primary', $index)) {
+ if (array_key_exists('primary', $index) ||
array_key_exists('unique', $index)) {
$result = $this->db->manager->createConstraint($table_name,
$index_name, $index);
} else {
$result = $this->db->manager->createIndex($table_name, $index_name,
$index);
@@ -1351,7 +1351,7 @@
}
if (array_key_exists('remove', $changes)) {
foreach ($changes['remove'] as $index_name => $index) {
- if (array_key_exists('primary', $index)) {
+ if (array_key_exists('primary', $index) ||
array_key_exists('unique', $index)) {
$result = $this->db->manager->dropConstraint($table_name,
$index_name);
} else {
$result = $this->db->manager->dropIndex($table_name, $index_name);