Page MenuHomeIn-Portal Phabricator

inst_ado.php
No OneTemporary

File Metadata

Created
Wed, Nov 18, 3:03 PM

inst_ado.php

<?php
/**
* Returns reference to database connection
*
* @param bool $new_type Return Kernel4 or in-portal connection object
* @return kDBConnection
*/
function &inst_GetADODBConnection($new_type = false)
{
static $DB = null;
global $g_DBType, $g_DBHost, $g_DBUser, $g_DBUserPassword, $g_DBName, $g_DebugMode;
global $ADODB_FETCH_MODE, $ADODB_COUNTRECS, $ADODB_CACHE_DIR, $pathtoroot;
if ($new_type) {
static $new_db = null;
if (!isset($new_db) && $g_DBType) {
require_once FULL_PATH.'/core/kernel/db/db_connection.php';
$new_db = new kDBConnection($g_DBType);
$new_db->Connect($g_DBHost, $g_DBUser, $g_DBUserPassword, $g_DBName);
}
return $new_db;
}
if( !isset($DB) && strlen($g_DBType) > 0 )
{
$DB = ADONewConnection($g_DBType);
$connected = $DB->Connect($g_DBHost, $g_DBUser, $g_DBUserPassword, $g_DBName);
$ADODB_CACHE_DIR = $pathtoroot.'cache';
$ADODB_FETCH_MODE = 2;
$ADODB_COUNTRECS = false;
$DB->debug = false;
$DB->cacheSecs = 3600;
}
return $DB;
}
?>

Event Timeline