本文整理汇总了PHP中ADOConnection::query方法的典型用法代码示例。如果您正苦于以下问题:PHP ADOConnection::query方法的具体用法?PHP ADOConnection::query怎么用?PHP ADOConnection::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ADOConnection
的用法示例。
在下文中一共展示了ADOConnection::query方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConnection
/**
* Метод получения коннекта к БД
*
* @return ADOConnection
*/
protected final function getConnection()
{
if ($this->CONNECTION != null) {
return $this->CONNECTION;
//---
}
if (!$this->isConfigured()) {
PsUtil::raise('Cannot get DB connection, {} is not configured.', get_called_class());
}
$this->LOGGER->info();
$this->LOGGER->info('? Connection for [{}] is requested', $this->CONNECTION_PARAMS);
$URL = $this->CONNECTION_PARAMS->url();
//Посмотрим, есть ли у нас нужный коннект
if (array_key_exists($URL, $this->CONNECTIONS)) {
$this->LOGGER->info('< Fast returned from cache');
return $this->CONNECTION = $this->CONNECTIONS[$URL];
}
//Отлогируем
$this->LOGGER->info('+ Establishing connection {}', $this->CONNECTION_PARAMS);
//Подключаем adodb
PsLibs::inst()->AdoDb();
//Подключаемся
$this->CONNECTION = ADONewConnection($URL);
if (!is_object($this->CONNECTION)) {
PsUtil::raise("Unable to connect to [{}]", $this->CONNECTION_PARAMS);
}
//Зададим некоторые настройки
$this->CONNECTION->debug = ADODB_DEBUG;
$this->CONNECTION->SetFetchMode(ADODB_FETCH_ASSOC);
$this->CONNECTION->query("SET NAMES 'utf8'");
$this->CONNECTION->query("SET CHARACTER SET 'utf8'");
//Положим соединение в пул
if (array_key_exists($URL, $this->CONNECTIONS)) {
raise_error('Double trying to register db connection');
}
$this->LOGGER->info('< Established connection returned');
return $this->CONNECTIONS[$URL] = $this->CONNECTION;
}