- 前ページ
- 次ページ
<?php
require_once('db_test.php');
class Dao extends DB {
private static $singleton_flg = null;
private $_obj_db = null;
// コンストラクタ
private function __construct() {
echo "インスタンスを生成しました Dao<br />";
$this -> _obj_db = DB::GetInstance();
}
// インスタンスを生成する
public static function GetInstance(){
if (Dao::$singleton_flg == null){
$obj_dao = new Dao();
Dao::$singleton_flg = true;
}else{
echo "インスタンスは既に存在します<br />";
}
return $obj_dao;
}
//-------------------------------------------------------------
//ここから上は変えない
//-------------------------------------------------------------
public function GetSomething(){
$sql = "select * from user where user = ? and max_connections = ?";
$data_type = array('text','integer');
$data = array('root',0);
$query_type = "select";
$db = "sns";
$rslt = $this -> _obj_db -> execQuery($sql,$data_type,$data,$query_type,$db);
if(PEAR::isError($rslt)){
return false;
}else{
return $rslt;
}
}
}
?>
