mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-10 20:44:28 +09:00
#19623705 DB 클래스 정리
1. DB 드라이버 생성방식 수정 2. $class_name, $class_file 이름 문자열 생성하는 부분 수정 git-svn-id: http://xe-core.googlecode.com/svn/sandbox@8184 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
2c25d64fb5
commit
59bf3cbb83
10 changed files with 90 additions and 6 deletions
|
|
@ -55,13 +55,13 @@
|
||||||
if(!$db_type && Context::isInstalled()) return new Object(-1, 'msg_db_not_setted');
|
if(!$db_type && Context::isInstalled()) return new Object(-1, 'msg_db_not_setted');
|
||||||
|
|
||||||
if(!$GLOBALS['__DB__']) {
|
if(!$GLOBALS['__DB__']) {
|
||||||
$class_name = sprintf("DB%s%s", strtoupper(substr($db_type, 0, 1)), strtolower(substr($db_type,1)));
|
$class_name = 'DB'.ucfirst($db_type);
|
||||||
$class_file = sprintf("%sclasses/db/%s.class.php", _XE_PATH_, $class_name);
|
$class_file = _XE_PATH_."classes/db/$class_name.class.php";
|
||||||
if(!file_exists($class_file)) new Object(-1, 'msg_db_not_setted');
|
if(!file_exists($class_file)) new Object(-1, 'msg_db_not_setted');
|
||||||
|
|
||||||
require_once($class_file);
|
// get a singletone instance of the database driver class
|
||||||
$get_db = create_function('', sprintf('$GLOBALS["__DB__"]["%s"] = new %s();', $db_type, $class_name));
|
require_once($class_file);
|
||||||
$get_db();
|
$GLOBALS['__DB__'][$db_type] = call_user_func(array($class_name, 'create'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $GLOBALS['__DB__'][$db_type];
|
return $GLOBALS['__DB__'][$db_type];
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,14 @@
|
||||||
$this->_connect();
|
$this->_connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief create an instance of this class
|
||||||
|
*/
|
||||||
|
function create()
|
||||||
|
{
|
||||||
|
return new DBCubrid;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치 가능 여부를 return
|
* @brief 설치 가능 여부를 return
|
||||||
**/
|
**/
|
||||||
|
|
@ -1244,4 +1252,6 @@
|
||||||
return $buff;
|
return $buff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new DBCubrid;
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,14 @@
|
||||||
$this->_connect();
|
$this->_connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief create an instance of this class
|
||||||
|
*/
|
||||||
|
function create()
|
||||||
|
{
|
||||||
|
return new DBFireBird;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치 가능 여부를 return
|
* @brief 설치 가능 여부를 return
|
||||||
**/
|
**/
|
||||||
|
|
@ -1057,4 +1065,6 @@
|
||||||
return $buff;
|
return $buff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new DBFireBird;
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,14 @@
|
||||||
$this->_connect();
|
$this->_connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief create an instance of this class
|
||||||
|
*/
|
||||||
|
function create()
|
||||||
|
{
|
||||||
|
return new DBMssql;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치 가능 여부를 return
|
* @brief 설치 가능 여부를 return
|
||||||
**/
|
**/
|
||||||
|
|
@ -895,4 +903,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new DBMssql;
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,10 @@
|
||||||
$this->_connect();
|
$this->_connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function create() {
|
||||||
|
return new DBMysql;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치 가능 여부를 return
|
* @brief 설치 가능 여부를 return
|
||||||
**/
|
**/
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,14 @@
|
||||||
$this->_connect();
|
$this->_connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief create an instance of this class
|
||||||
|
*/
|
||||||
|
function create()
|
||||||
|
{
|
||||||
|
return new DBMysql_innodb;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB접속 해제
|
* @brief DB접속 해제
|
||||||
**/
|
**/
|
||||||
|
|
@ -151,4 +159,6 @@
|
||||||
if(!$output) return false;
|
if(!$output) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new DBMysql_innodb;
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,14 @@
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief create an instance of this class
|
||||||
|
*/
|
||||||
|
function create()
|
||||||
|
{
|
||||||
|
return new DBMysqli;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB 접속
|
* @brief DB 접속
|
||||||
**/
|
**/
|
||||||
|
|
@ -110,4 +118,6 @@
|
||||||
return mysqli_fetch_object($result);
|
return mysqli_fetch_object($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new DBMysqli;
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,14 @@ class DBPostgresql extends DB
|
||||||
$this->_connect();
|
$this->_connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief create an instance of this class
|
||||||
|
*/
|
||||||
|
function create()
|
||||||
|
{
|
||||||
|
return new DBPostgresql;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치 가능 여부를 return
|
* @brief 설치 가능 여부를 return
|
||||||
**/
|
**/
|
||||||
|
|
@ -927,4 +935,6 @@ class DBPostgresql extends DB
|
||||||
return $buff;
|
return $buff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new DBPostgresql;
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,14 @@
|
||||||
$this->_connect();
|
$this->_connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief create an instance of this class
|
||||||
|
*/
|
||||||
|
function create()
|
||||||
|
{
|
||||||
|
return new DBSqlite2;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치 가능 여부를 return
|
* @brief 설치 가능 여부를 return
|
||||||
**/
|
**/
|
||||||
|
|
@ -722,4 +730,6 @@
|
||||||
return $buff;
|
return $buff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new DBSqlite2;
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,14 @@
|
||||||
$this->_connect();
|
$this->_connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief create an instance of this class
|
||||||
|
*/
|
||||||
|
function create()
|
||||||
|
{
|
||||||
|
return new DBSqlite3_pdo;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치 가능 여부를 return
|
* @brief 설치 가능 여부를 return
|
||||||
**/
|
**/
|
||||||
|
|
@ -806,4 +814,6 @@
|
||||||
return $buff;
|
return $buff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new DBSqlite3_pdo;
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue