Removing unused function get_course_table_from_code see #3910

skala
Julio Montoya 14 years ago
parent 1a8f10cdff
commit dc0cf75139
  1. 22
      main/inc/lib/database.lib.php
  2. 19
      main/inc/lib/database.mysqli.lib.php
  3. 4
      main/inc/lib/search/tool_processors/learnpath_processor.class.php
  4. 10
      tests/main/inc/lib/database.lib.test.php

@ -179,28 +179,6 @@ class Database {
//return self::format_glued_course_table_name(self::fix_database_parameter($database_name), $short_table_name);
}
/**
* Gets a complete course table name from a course code
*
* @param string $course_code
* @param string $table the name of the table
* @todo this function should be deprecated use api_get_course_info()
* and then get_course_table()
*/
public static function get_course_table_from_code($course_code, $table) {
$course_table = self::get_main_table(TABLE_MAIN_COURSE);
$course_cat_table = self::get_main_table(TABLE_MAIN_CATEGORY);
$sql = "SELECT $course_table.db_name, $course_cat_table.code
FROM $course_table
LEFT JOIN $course_cat_table
ON $course_table.category_code = $course_cat_table.code
WHERE $course_table.code = '$course_code'
LIMIT 1";
$result = self::fetch_array(self::query($sql));
return sprintf("%s.%s", $result[0], $table);
}
/**
* This generic method returns the correct and complete name of any
* statistic table of which you pass the short name as a parameter.

@ -168,25 +168,6 @@ class Database {
return self::format_glued_course_table_name(self::fix_database_parameter($database_name), $short_table_name);
}
/**
* Gets a complete course table name from a course code
*
* @param string $course_code
* @param string $table the name of the table
*/
public static function get_course_table_from_code($course_code, $table) {
$course_table = self::get_main_table(TABLE_MAIN_COURSE);
$course_cat_table = self::get_main_table(TABLE_MAIN_CATEGORY);
$result = self::fetch_array(self::query(
"SELECT $course_table.db_name, $course_cat_table.code
FROM $course_table
LEFT JOIN $course_cat_table
ON $course_table.category_code = $course_cat_table.code
WHERE $course_table.code = '$course_code'
LIMIT 1"));
return sprintf("%s.%s", $result[0], $table);
}
/**
* This generic method returns the correct and complete name of any statistic table
* of which you pass the short name as a parameter.

@ -92,8 +92,8 @@ class learnpath_processor extends search_processor {
if (!empty($course_information)) {
$lpi_table = Database::get_course_table(TABLE_LP_ITEM);
$lp_table = Database::get_course_table_from_code(TABLE_LP_MAIN);
$doc_table = Database::get_course_table_from_code(TABLE_DOCUMENT);
$lp_table = Database::get_course_table(TABLE_LP_MAIN);
$doc_table = Database::get_course_table(TABLE_DOCUMENT);
$lp_id = Database::escape_string($lp_id);

@ -152,15 +152,7 @@ class TestDatabase extends UnitTestCase {
$res=$this->dbase->get_course_table($short_table_name,$database_name);
$this->assertTrue(is_string($res));
}
function testGetCourseTableFromCode() {
$course_code='AYDD';
$table='course';
$ret = NULL;
$res=$this->dbase->get_course_table_from_code($course_code, $table);
$this->assertTrue(is_string($res));
}
function testGetCourseTablePrefix() {
global $_configuration;
$res=$this->dbase->get_course_table_prefix($_configuration);

Loading…
Cancel
Save