From d54f85efa6f038c487b11d2b2f49e57e1b3f4f05 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Thu, 28 Sep 2006 21:47:36 +0000 Subject: [PATCH] minor adjust. keytype to drop keys is not needed anymore. now it's defined in mysql generator (the only one needing it) --- .../classes/generators/XMLDBGenerator.class.php | 10 +++------- lib/xmldb/classes/generators/mysql/mysql.class.php | 12 ++++++------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/xmldb/classes/generators/XMLDBGenerator.class.php b/lib/xmldb/classes/generators/XMLDBGenerator.class.php index 15b8f667b9..e12b975a3b 100644 --- a/lib/xmldb/classes/generators/XMLDBGenerator.class.php +++ b/lib/xmldb/classes/generators/XMLDBGenerator.class.php @@ -66,13 +66,13 @@ class XMLDBgenerator { var $foreign_keys = false; // Does the generator build foreign keys var $drop_primary_key = 'ALTER TABLE TABLENAME DROP CONSTRAINT KEYNAME'; // Template to drop PKs - // with automatic replace for TABLENAME, KEYTYPE and KEYNAME + // with automatic replace for TABLENAME and KEYNAME var $drop_unique_key = 'ALTER TABLE TABLENAME DROP CONSTRAINT KEYNAME'; // Template to drop UKs - // with automatic replace for TABLENAME, KEYTYPE and KEYNAME + // with automatic replace for TABLENAME and KEYNAME var $drop_foreign_key = 'ALTER TABLE TABLENAME DROP CONSTRAINT KEYNAME'; // Template to drop FKs - // with automatic replace for TABLENAME, KEYTYPE and KEYNAME + // with automatic replace for TABLENAME and KEYNAME var $sequence_extra_code = true; //Does the generator need to add extra code to generate the sequence fields var $sequence_name = 'auto_increment'; //Particular name for inline sequences in this generator @@ -656,14 +656,12 @@ class XMLDBgenerator { case XMLDB_KEY_PRIMARY: if ($this->primary_keys) { $template = $this->drop_primary_key; - $keytype = 'PRIMARY'; $dropkey = true; } break; case XMLDB_KEY_UNIQUE: if ($this->unique_keys) { $template = $this->drop_unique_key; - $keytype = 'UNIQUE'; $dropkey = true; } break; @@ -671,7 +669,6 @@ class XMLDBgenerator { case XMLDB_KEY_FOREIGN: if ($this->foreign_keys) { $template = $this->drop_foreign_key; - $keytype = 'FOREIGN KEY'; $dropkey = true; } break; @@ -680,7 +677,6 @@ class XMLDBgenerator { if ($dropkey) { /// Replace TABLENAME, CONSTRAINTTYPE and KEYNAME as needed $dropsql = str_replace('TABLENAME', $this->getEncQuoted($this->prefix . $xmldb_table->getName()), $template); - $dropsql = str_replace('KEYTYPE', $keytype, $dropsql); $dropsql = str_replace('KEYNAME', $dbkeyname, $dropsql); $results[] = $dropsql; diff --git a/lib/xmldb/classes/generators/mysql/mysql.class.php b/lib/xmldb/classes/generators/mysql/mysql.class.php index e8e3896aff..89865a2358 100644 --- a/lib/xmldb/classes/generators/mysql/mysql.class.php +++ b/lib/xmldb/classes/generators/mysql/mysql.class.php @@ -41,14 +41,14 @@ class XMLDBmysql extends XMLDBGenerator { var $primary_key_name = ''; //To force primary key names to one string (null=no force) - var $drop_primary_key = 'ALTER TABLE TABLENAME DROP KEYTYPE KEYNAME'; // Template to drop PKs - // with automatic replace for TABLENAME, KEYTYPE and KEYNAME + var $drop_primary_key = 'ALTER TABLE TABLENAME DROP PRIMARY KEY'; // Template to drop PKs + // with automatic replace for TABLENAME and KEYNAME - var $drop_unique_key = 'ALTER TABLE TABLENAME DROP KEYTYPE KEYNAME'; // Template to drop UKs - // with automatic replace for TABLENAME, KEYTYPE and KEYNAME + var $drop_unique_key = 'ALTER TABLE TABLENAME DROP KEY KEYNAME'; // Template to drop UKs + // with automatic replace for TABLENAME and KEYNAME - var $drop_foreign_key = 'ALTER TABLE TABLENAME DROP KEYTYPE KEYNAME'; // Template to drop FKs - // with automatic replace for TABLENAME, KEYTYPE and KEYNAME + var $drop_foreign_key = 'ALTER TABLE TABLENAME DROP FOREIGN KEY KEYNAME'; // Template to drop FKs + // with automatic replace for TABLENAME and KEYNAME var $sequence_extra_code = false; //Does the generator need to add extra code to generate the sequence fields var $sequence_name = 'auto_increment'; //Particular name for inline sequences in this generator -- 2.39.5