Introducing CFG->dbfamily and deleting check_db_compat(). MDL-7061

This commit is contained in:
stronk7 2007-01-12 19:42:42 +00:00
parent 32db0d42c9
commit 485056620e

View file

@ -787,7 +787,7 @@ function get_courses_search($searchterms, $sort='fullname ASC', $page=0, $record
global $CFG; global $CFG;
//to allow case-insensitive search for postgesql //to allow case-insensitive search for postgesql
if ($CFG->dbtype == 'postgres7') { if ($CFG->dbfamily == 'postgres') {
$LIKE = 'ILIKE'; $LIKE = 'ILIKE';
$NOTLIKE = 'NOT ILIKE'; // case-insensitive $NOTLIKE = 'NOT ILIKE'; // case-insensitive
$REGEXP = '~*'; $REGEXP = '~*';
@ -806,7 +806,7 @@ function get_courses_search($searchterms, $sort='fullname ASC', $page=0, $record
/// Under Oracle and MSSQL, trim the + and - operators and perform /// Under Oracle and MSSQL, trim the + and - operators and perform
/// simpler LIKE search /// simpler LIKE search
if ($CFG->dbtype == 'oci8po' || $CFG->dbtype == 'mssql' || $CFG->dbtype == 'mssql_n' || $CFG->dbtype == 'odbc_mssql') { if ($CFG->dbfamily == 'oracle' || $CFG->dbfamily == 'mssql') {
$searchterm = trim($searchterm, '+-'); $searchterm = trim($searchterm, '+-');
} }
@ -967,7 +967,7 @@ function fix_course_sortorder($categoryid=0, $n=0, $safe=0, $depth=0, $path='')
$n = $n + $catgap; $n = $n + $catgap;
// if the new sequence overlaps the current sequence, lack of transactions // if the new sequence overlaps the current sequence, lack of transactions
// will stop us -- shift things aside for a moment... // will stop us -- shift things aside for a moment...
if ($safe || ($n >= $min && $n+$count+1 < $min && $CFG->dbtype==='mysql')) { if ($safe || ($n >= $min && $n+$count+1 < $min && $CFG->dbfamily==='mysql')) {
$shift = $max + $n + 1000; $shift = $max + $n + 1000;
execute_sql("UPDATE {$CFG->prefix}course execute_sql("UPDATE {$CFG->prefix}course
SET sortorder=sortorder+$shift SET sortorder=sortorder+$shift
@ -1548,29 +1548,6 @@ function print_object($object) {
echo '<pre>'.htmlspecialchars(print_r($object,true)).'</pre>'; echo '<pre>'.htmlspecialchars(print_r($object,true)).'</pre>';
} }
/**
* Checks for pg or mysql > 4
*/
function check_db_compat() {
global $CFG,$db;
if ($CFG->dbtype == 'postgres7') {
return true;
}
if (!$rs = $db->Execute("SELECT version();")) {
return false;
}
if (intval($rs->fields[0]) <= 3) {
return false;
}
return true;
}
function course_parent_visible($course = null) { function course_parent_visible($course = null) {
global $CFG; global $CFG;