getDB(), getRootDB()를 autoload 클래스로 변경
- 각각 DB::db(), RootDB::db()임.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
class DB{
|
||||
private static $uDB = null;
|
||||
|
||||
private static $host = '_tK_host_';
|
||||
private static $user = '_tK_user_';
|
||||
private static $password = '_tK_password_';
|
||||
private static $dbName = '_tK_dbName_';
|
||||
private static $port = _tK_port_;
|
||||
private static $encoding = 'utf8';
|
||||
|
||||
private static $prefix = '_tK_prefix_';
|
||||
|
||||
private function __construct(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* DB 객체 생성
|
||||
*
|
||||
* @return \MeekroDB
|
||||
*/
|
||||
public static function db(){
|
||||
if(self::$uDB === null){
|
||||
self::$uDB = new \MeekroDB(self::$host,self::$user,self::$password,self::$dbName,self::$port,self::$encoding);
|
||||
self::$uDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true;
|
||||
}
|
||||
return self::$uDB;
|
||||
}
|
||||
|
||||
public static function prefix()
|
||||
{
|
||||
return self::$prefix;
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
require_once(__dir__.'/../../d_setting/conf.php');
|
||||
|
||||
/**
|
||||
* DB 객체 생성
|
||||
*
|
||||
* @return \MeekroDB
|
||||
*/
|
||||
function getDB(){
|
||||
$host = '_tK_host_';
|
||||
$user = '_tK_user_';
|
||||
$password = '_tK_password_';
|
||||
$dbName = '_tK_dbName_';
|
||||
$port = _tK_port_;
|
||||
$encoding = 'utf8';
|
||||
|
||||
static $uDB = null;
|
||||
|
||||
if($uDB === null){
|
||||
$uDB = new \MeekroDB($host,$user,$password,$dbName,$port,$encoding);
|
||||
$uDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true;
|
||||
}
|
||||
|
||||
return $uDB;
|
||||
}
|
||||
|
||||
function getServPrefix()
|
||||
{
|
||||
return '_tK_prefix_';
|
||||
}
|
||||
Reference in New Issue
Block a user