<?php
/**
* @author 黄建文
* @version v1.0
* @email hjwtp2005@qq.com
* @example
* $db=db_factcory::create('MYSQL','localhost','root','admin','emtit');
* $sqlstr="SELECT * FROM member WHERE memberid=1";
* $db->get_one($sqlstr);
*/
include 'db_mysql.php';
class db_factory {
function db_factory() {
}
static function create($type,$dbhost,$username,$password,$dbname='',$dbcharset=''){
switch ($type){
case 'MYSQL':
return new db_mysql($dbhost,$username,$password,$dbname,$dbcharset);
case 'SQLSERVER':
return new db_sqlserver($dbhost,$username,$password,$dbname,$dbcharset);
case 'ACCESS':
return new db_access($dbhost,$username,$password,$dbname,$dbcharset);
case 'ORACLE':
return new db_oracle($dbhost,$username,$password,$dbname,$dbcharset);
}
return false;
}
function __destruct() {
}
}
?>
您可能感兴趣的文章: