$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;
$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;
$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;
$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;
$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;
}
}
-
- /**
- * 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
*
$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
$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();
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