本文整理汇总了PHP中Zend_Db_Adapter_Pdo_Abstract::_connect方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Adapter_Pdo_Abstract::_connect方法的具体用法?PHP Zend_Db_Adapter_Pdo_Abstract::_connect怎么用?PHP Zend_Db_Adapter_Pdo_Abstract::_connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Db_Adapter_Pdo_Abstract
的用法示例。
在下文中一共展示了Zend_Db_Adapter_Pdo_Abstract::_connect方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _connect
/**
* @return void
*/
protected function _connect()
{
if ($this->_connection) {
return;
}
parent::_connect();
$this->_connection->exec('SET QUOTED_IDENTIFIER ON');
}
示例2: _connect
/**
* 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);
}
}
示例3: _connect
/**
* Creates a PDO object and connects to the database.
*
* @return void
* @throws Zend_Db_Adapter_Exception
*/
protected function _connect()
{
if ($this->_connection) {
return;
}
if (!empty($this->_config['charset'])) {
$initCommand = "SET NAMES '" . $this->_config['charset'] . "'";
$this->_config['driver_options'][PDO::MYSQL_ATTR_INIT_COMMAND] = $initCommand;
}
parent::_connect();
}
示例4: _connect
/**
* Creates a PDO object and connects to the database.
*
* @return void
* @throws Zend_Db_Adapter_Exception
*/
protected function _connect()
{
if ($this->_connection) {
return;
}
if (!empty($this->_config['charset']) && version_compare(PHP_VERSION, '5.3.6', '<')) {
$initCommand = "SET NAMES '" . $this->_config['charset'] . "'";
$this->_config['driver_options'][1002] = $initCommand;
// 1002 = PDO::MYSQL_ATTR_INIT_COMMAND
}
parent::_connect();
}
示例5: _connect
/**
* 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();
/**
* Mantis #0009452 - This feature was disable for making possible to enable transaction pooling
if (!empty($this->_config['charset'])) {
$sql = "SET NAMES '" . $this->_config['charset'] . "'";
$this->_connection->exec($sql);
}
**/
}
示例6: _connect
/**
* Creates a PDO object and connects to the database.
*
* The IBM data server is set.
* Current options are DB2 or IDS
* @todo also differentiate between z/OS and i/5
*
* @return void
* @throws Zend_Db_Adapter_Exception
*/
public function _connect()
{
if ($this->_connection) {
return;
}
parent::_connect();
$this->getConnection()->setAttribute(Zend_Db::ATTR_STRINGIFY_FETCHES, true);
try {
if ($this->_serverType === null) {
$server = substr($this->getConnection()->getAttribute(PDO::ATTR_SERVER_INFO), 0, 3);
switch ($server) {
case 'DB2':
$this->_serverType = new Zend_Db_Adapter_Pdo_Ibm_Db2($this);
// Add DB2-specific numeric types
$this->_numericDataTypes['DECFLOAT'] = Zend_Db::FLOAT_TYPE;
$this->_numericDataTypes['DOUBLE'] = Zend_Db::FLOAT_TYPE;
$this->_numericDataTypes['NUM'] = Zend_Db::FLOAT_TYPE;
break;
case 'IDS':
$this->_serverType = new Zend_Db_Adapter_Pdo_Ibm_Ids($this);
// Add IDS-specific numeric types
$this->_numericDataTypes['SERIAL'] = Zend_Db::INT_TYPE;
$this->_numericDataTypes['SERIAL8'] = Zend_Db::BIGINT_TYPE;
$this->_numericDataTypes['INT8'] = Zend_Db::BIGINT_TYPE;
$this->_numericDataTypes['SMALLFLOAT'] = Zend_Db::FLOAT_TYPE;
$this->_numericDataTypes['MONEY'] = Zend_Db::FLOAT_TYPE;
break;
}
}
} catch (PDOException $e) {
/** @see Zend_Db_Adapter_Exception */
require_once 'Zend/Db/Adapter/Exception.php';
$error = strpos($e->getMessage(), 'driver does not support that attribute');
if ($error) {
throw new Zend_Db_Adapter_Exception("PDO_IBM driver extension is downlevel. Please use driver release version 1.2.1 or later", 0, $e);
} else {
throw new Zend_Db_Adapter_Exception($e->getMessage(), $e->getCode(), $e);
}
}
}
示例7: _connect
/**
* Special configuration for SQLite behavior: make sure that result sets
* contain keys like 'column' instead of 'table.column'.
*
* @throws Zend_Db_Adapter_Exception
*/
protected function _connect()
{
/**
* if we already have a PDO object, no need to re-connect.
*/
if ($this->_connection) {
return;
}
parent::_connect();
$retval = $this->_connection->exec('PRAGMA full_column_names=0');
if ($retval === false) {
$error = $this->_connection->errorInfo();
/** @see Zend_Db_Adapter_Exception */
require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception($error[2]);
}
$retval = $this->_connection->exec('PRAGMA short_column_names=1');
if ($retval === false) {
$error = $this->_connection->errorInfo();
/** @see Zend_Db_Adapter_Exception */
require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception($error[2]);
}
}