Dao.php 656 Bytes
<?php
/**
 * Created by PhpStorm.
 * User: Zip
 * Date: 15/4/6
 * Time: 下午3:06
 */

namespace QSns;

use Hood\DB;

class Dao
{
    protected $key = '';

    /**
     * @var \Hood\Dao\Db\PDOMySQL\Quick
     */
    private $_dao = null;

    private $dbName = '';

    public function __construct($dbName = 'buysns')
    {
        $this->key = $this->dbName = Config::DB_PREFIX . $dbName;
    }

    /**
     * @param string $database
     * @return \Hood\Dao\Db\PDOMySQL\Quick
     */
    protected function dao()
    {
        if ($this->_dao == null) {
            $this->_dao = DB::Quick($this->dbName);
        }
        return $this->_dao;
    }
}