$LIKE = sql_ilike();
$NOTLIKE = 'NOT ' . $LIKE;
- if ($CFG->dbtype == "postgres7") {
+ if ($CFG->dbfamily == "postgres") {
$REGEXP = "~*";
$NOTREGEXP = "!~*";
} else {
$value = $parsetree[$i]->getValue();
/// Under Oracle and MSSQL, transform TOKEN searches into STRING searches and trim +- chars
- if ($CFG->dbtype == 'oci8po' || $CFG->dbtype == 'mssql' || $CFG->dbtype == 'mssql_n' || $CFG->dbtype == 'odbc_mssql') {
+ if ($CFG->dbfamily == 'oracle' || $CFG->dbfamily == 'mssql') {
$value = trim($value, '+-');
if ($type == TOKEN_EXACT) {
$type = TOKEN_STRING;
$unicodedb = false;
- // Since this function is also used during installation process, i.e. during install.php before $CFG->dbtype is set.
- // we need to get dbtype from the right variable
- if (!empty($INSTALL['dbtype'])) {
- $dbtype = $INSTALL['dbtype'];
- } else {
- $dbtype = $CFG->dbtype;
- }
+ // Calculate $CFG->dbfamily
+ $dbfamily = set_dbfamily();
- switch ($dbtype) {
+ switch ($dbfamily) {
case 'mysql':
- case 'mysqli':
$rs = $db->Execute("SHOW VARIABLES LIKE 'character_set_database'");
if ($rs && $rs->RecordCount() > 0) {
$records = $rs->GetAssoc(true);
}
}
break;
- case 'postgres7':
+ case 'postgres':
/// Get PostgreSQL server_encoding value
$rs = $db->Execute("SHOW server_encoding");
if ($rs && $rs->RecordCount() > 0) {
}
break;
case 'mssql':
- case 'mssql_n':
- case 'odbc_mssql':
/// MSSQL only runs under UTF8 + the proper ODBTP driver (both for Unix and Win32)
$unicodedb = true;
break;
- case 'oci8po':
+ case 'oracle':
/// Get Oracle DB character set value
$rs = $db->Execute("SELECT parameter, value FROM nls_database_parameters where parameter = 'NLS_CHARACTERSET'");
if ($rs && $rs->RecordCount() > 0) {
$maxid = $row[$idcol];
}
}
- if ($CFG->dbtype == 'postgres7' && $idcol !== false) {
+ if ($CFG->dbfamily == 'postgres' && $idcol !== false) {
$maxid += 1;
_private_execute_sql("ALTER SEQUENCE {$tablename}_id_seq RESTART WITH $maxid;", $localdb);
}
global $CFG;
_private_execute_sql('DROP TABLE ' . $tablename . ($cascade ? ' CASCADE' : '') . ';', $db);
- if ($CFG->dbtype == 'postgres7') {
+ if ($CFG->dbfamily == 'postgres') {
$rs = $db->Execute("SELECT relname FROM pg_class WHERE relname = '{$tablename}_id_seq' AND relkind = 'S';");
if ($rs && $rs->RecordCount()) {
_private_execute_sql("DROP SEQUENCE {$tablename}_id_seq;", $db);
function wipe_sequences($prefix, $db) {
global $CFG;
- if ($CFG->dbtype == 'postgres7') {
+ if ($CFG->dbfamily == 'postgres') {
$sequences = $db->GetCol("SELECT relname FROM pg_class WHERE relname LIKE '$prefix%_id_seq' AND relkind = 'S';");
if ($sequences) {
foreach ($sequences as $sequence) {
$this->change_prefix_back();
}
}
-?>
\ No newline at end of file
+?>
// compatibility - if we're in postgres, cast to real for some reports.
$real = '';
- if ($CFG->dbtype == 'postgres7') {
+ if ($CFG->dbfamily == 'postgres') {
$real = '::real';
}
/// Some differences in SQL syntax
$LIKE = sql_ilike();
$NOTLIKE = 'NOT ' . $LIKE;
- if ($CFG->dbtype == "postgres7") {
+ if ($CFG->dbfamily == "postgres") {
$REGEXP = "~*";
$NOTREGEXP = "!~*";
} else {
}
/// Under Oracle and MSSQL, trim the + and - operators and perform
/// 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, '+-');
}