/** * Инициализация объекта для работы с БД. * * @return Db_Pdo */ protected function get_db() { $config = $this->_config['db']; $db = Db_Pdo::create($config['dsn'], $config['user'], $config['passwd'], $config['options']); $db->exec('SET NAMES utf8'); return $db; }
public function __construct() { $this->request = APF::get_instance()->get_request(); $this->response = APF::get_instance()->get_response(); $p = $this->request->get_parameters(); $this->check_sig($p); Db_Pdo::get_instance(); }
public function __construct() { $this->request = APF::get_instance()->get_request(); $this->response = APF::get_instance()->get_response(); $cookie_cfg = APF::get_instance()->get_config('cookie'); $cookie_value = Bll_Cookie::get($cookie_cfg['name']); $user_info_str = Util_AuthorCrypt::decrypt($cookie_value, $cookie_cfg['key']); $user_info_arr = json_decode($user_info_str, true); $this->userInfo = $user_info_arr[0]; Db_Pdo::get_instance(); }
public function __construct($file_name, $dsn, $user, $passwd) { if (false === ($this->_link = dbase_open($file_name, 0))) { throw new Exception('Не удалось открыть файл ' . $file_name); } $options = array(Db_Pdo::ATTR_ERRMODE => Db_Pdo::ERRMODE_EXCEPTION); $this->_db = Db_Pdo::create($dsn, $user, $passwd, $options); $this->_db->exec('SET NAMES utf8'); $sql = ' INSERT INTO regions (code, name) VALUES (:code, :name) '; $this->_insert_region = $this->_db->prepare($sql); $sql = ' INSERT INTO localities (region_id, code, name, type) VALUES (:region_id, :code, :name, :type) '; $this->_insert_locality = $this->_db->prepare($sql); }
/** * Закрывает строку в кавычки для использования в запросах. * * @link http://www.php.net/manual/en/pdo.quote.php * * @param string $string Исходная строка. * @return string */ protected function quote($string) { return $this->_db->quote($string); }
public static function get_instance() { self::$db = APF_DB_Factory::get_instance()->get_pdo('cms_user'); return self::$db; }