mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-20349 find_sequence_name() is out. No need to use it anymore.
This commit is contained in:
parent
3bbd1cd2f7
commit
15a0ffc8f0
@ -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;
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user