/** * Creates a Pdo object and connects to the database. * * @return void * @throws \Zend\Db\Adapter\Exception */ protected function _connect() { if ($this->_connection) { return; } parent::_connect(); if (!empty($this->_config['charset'])) { $sql = "SET NAMES '" . $this->_config['charset'] . "'"; $this->_connection->exec($sql); } }
/** * Execute a SQL query * * @param string $query * @param array $data * @param int $flag * @return bool|array * @throws DatabaseException */ public function query(string $query, array $data, int $flag = 8) { return parent::pdoQuery(__METHOD__, $query, $data, $flag); }
/** * @return void */ protected function _connect() { if ($this->_connection) { return; } parent::_connect(); $this->_connection->exec('SET QUOTED_IDENTIFIER ON'); }