]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-20349 find_sequence_name() is out. No need to use it anymore.
authorstronk7 <stronk7>
Sun, 11 Oct 2009 21:52:40 +0000 (21:52 +0000)
committerstronk7 <stronk7>
Sun, 11 Oct 2009 21:52:40 +0000 (21:52 +0000)
admin/xmldb/actions/test/test.class.php
lib/ddl/database_manager.php
lib/ddl/oracle_sql_generator.php
lib/ddl/simpletest/testddl.php
lib/deprecatedlib.php

index 8e59a4fa2ceb9f1d5b0788a1e7db89268ea31cca..216794646a98d57239a8bbc0f49c407e92b9c9e1 100644 (file)
@@ -946,24 +946,7 @@ class test extends XMLDBAction {
             $tests['rename table'] = $test;
         }
 
-    /// 45th test. Getting the PK sequence name for one table
-        if ($test->status) {
-            $table->setName('newnameforthetable');
-            $test = new stdClass;
-            $test->sql =  array($dbman->find_sequence_name($table));
-            $test->status = $dbman->find_sequence_name($table);
-            if (!$test->status) {
-                if (!$test->error = $DB->get_last_error()) { //If no db errors, result is ok. Just the driver doesn't support this
-                    $test->sql = array('Not needed for this DB. Correct.');
-                    $test->status = true;
-                } else {
-                    $test->error .= "\n" . $e;
-                }
-            }
-            $tests['find sequence name'] = $test;
-        }
-
-    /// 46th test. Inserting TEXT contents
+    /// 45th test. Inserting TEXT contents
         $textlib = textlib_get_instance();
         if ($test->status) {
             $test = new stdClass;
@@ -1002,7 +985,7 @@ class test extends XMLDBAction {
             $tests['insert record '. $textlen . ' cc. (text)'] = $test;
         }
 
-    /// 47th test. Inserting BINARY contents
+    /// 46th test. Inserting BINARY contents
         if ($test->status) {
             $test = new stdClass;
             $test->status = false;
@@ -1031,7 +1014,7 @@ class test extends XMLDBAction {
             $tests['insert record '. $textlen . ' bytes (binary)'] = $test;
         }
 
-    /// 48th test. $DB->update_record with TEXT and BINARY contents
+    /// 47th test. $DB->update_record with TEXT and BINARY contents
         if ($test->status) {
             $test = new stdClass;
             $test->status = false;
@@ -1071,7 +1054,7 @@ class test extends XMLDBAction {
             $tests['update record '. $textlen . ' cc. (text) and ' . $imglen . ' bytes (binary)'] = $test;
         }
 
-    /// 49th test. $DB->set_field with TEXT contents
+    /// 48th test. $DB->set_field with TEXT contents
         if ($test->status) {
             $test = new stdClass;
             $test->status = false;
@@ -1101,7 +1084,7 @@ class test extends XMLDBAction {
             $tests['set field '. $textlen . ' cc. (text)'] = $test;
         }
 
-    /// 50th test. $DB->set_field with BINARY contents
+    /// 49th test. $DB->set_field with BINARY contents
         if ($test->status) {
             $test = new stdClass;
             $test->status = false;
index 60a469a4d3174c1cdb2659523f0d594a40019292..6411b87814a3e79786343d1817c5977593426554 100644 (file)
@@ -311,25 +311,6 @@ class database_manager {
         }
     }
 
-
-    /**
-     * Given one xmldb_table, the function returns the name of its sequence in DB
-     *
-     * @param xmldb_table the table to be searched
-     * @return string sequence name of false
-     */
-    public function find_sequence_name(xmldb_table $xmldb_table) {
-        if (!$this->table_exists($xmldb_table)) {
-            throw new ddl_table_missing_exception($xmldb_table->getName());
-        }
-
-        $sequencename = false;
-
-        $sequencename = $this->generator->getSequenceFromDB($xmldb_table);
-
-        return $sequencename;
-    }
-
     /**
      * This function will delete all tables found in XMLDB file from db
      *
index 87f908800fa2e85b239e90d6b10521a8df223cfb..f28530851754ab7fd95c70290cb42f95cb09cadd 100644 (file)
@@ -86,7 +86,7 @@ class oracle_sql_generator extends sql_generator {
         $value = (int)$this->mdb->get_field_sql('SELECT MAX(id) FROM {'.$tablename.'}');
         $value++;
 
-        $seqname = $this->mdb->get_manager()->find_sequence_name($xmldb_table);
+        $seqname = $this->getSequenceFromDB($xmldb_table);
 
         if (!$seqname) {
         /// Fallback, seqname not found, something is wrong. Inform and use the alternative getNameForObject() method
index 87c1bead725dd48dfdb2306f8db7a7524e2f5f2c..eae22e32932d9772750f9aebff5b2b2c730c5bcb 100755 (executable)
@@ -1183,25 +1183,6 @@ class ddl_test extends UnitTestCase {
         $this->assertTrue(!empty($result));
     }
 
-    public function testFindSequenceName() {
-        $dbman = $this->tdb->get_manager();
-
-        // give nonexistent table param
-        $table = new xmldb_table("nonexistenttable");
-        try {
-            $dbman->find_sequence_name($table);
-            $this->assertTrue(false);
-        } catch (Exception $e) {
-            $this->assertTrue($e instanceof moodle_exception);
-        }
-
-        // Give existing and valid table param
-        $table = $this->create_deftable('test_table0');
-//TODO: this returns stuff depending on db internals
-        // $this->assertEqual(false, $dbman->find_sequence_name($table));
-
-    }
-
     public function testDeleteTablesFromXmldbFile() {
         global $CFG;
         $dbman = $this->tdb->get_manager();
index 41468d5198da0b87a4c220caa636f53421fe790d..4db9b34a842f8695469c36a757583c0960ef12e2 100644 (file)
@@ -686,18 +686,6 @@ function find_key_name($table, $xmldb_key) {
     return $DB->get_manager()->find_key_name($table, $xmldb_key);
 }
 
-/**
- * @deprecated
- * @global object
- * @param string $table
- * @return bool
- */
-function find_sequence_name($table) {
-    global $DB;
-    debugging('Deprecated ddllib function used!');
-    return $DB->get_manager()->find_sequence_name($table);
-}
-
 /**
  * @deprecated
  * @global object