本文整理汇总了PHP中Elite_Vaf_Helper_Data::dbAdapter方法的典型用法代码示例。如果您正苦于以下问题:PHP Elite_Vaf_Helper_Data::dbAdapter方法的具体用法?PHP Elite_Vaf_Helper_Data::dbAdapter怎么用?PHP Elite_Vaf_Helper_Data::dbAdapter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Elite_Vaf_Helper_Data
的用法示例。
在下文中一共展示了Elite_Vaf_Helper_Data::dbAdapter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getReadAdapter
/** @return Zend_Db_Adapter_Abstract */
function getReadAdapter()
{
if (isset(self::$dbAdapter)) {
return self::$dbAdapter;
}
// cron
if (Zend_Registry::isRegistered('db')) {
return Zend_Registry::get('db');
}
// test code only
if (defined('ELITE_TESTING')) {
if (is_null(self::$dbAdapter)) {
self::$dbAdapter = new My_Adapter(array('dbname' => VAF_DB_NAME, 'username' => VAF_DB_USERNAME, 'password' => VAF_DB_PASSWORD));
self::$dbAdapter->getConnection()->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
self::$dbAdapter->getConnection()->query('SET character set utf8;');
self::$dbAdapter->getConnection()->query('SET character_set_client = utf8;');
self::$dbAdapter->getConnection()->query('SET character_set_results = utf8;');
self::$dbAdapter->getConnection()->query('SET character_set_connection = utf8;');
self::$dbAdapter->getConnection()->query('SET character_set_database = utf8;');
self::$dbAdapter->getConnection()->query('SET character_set_server = utf8;');
}
return self::$dbAdapter;
}
// end 'test code only'
$resource = Mage::getSingleton('core/resource');
$read = $resource->getConnection('core_read');
$read->query('SET character_set_client = utf8;');
$config = $read->getConfig();
self::$dbAdapter = new My_Adapter($config);
self::$dbAdapter->getConnection()->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
self::$dbAdapter->getConnection()->query('SET character set utf8;');
self::$dbAdapter->getConnection()->query('SET character_set_client = utf8;');
self::$dbAdapter->getConnection()->query('SET character_set_results = utf8;');
self::$dbAdapter->getConnection()->query('SET character_set_connection = utf8;');
self::$dbAdapter->getConnection()->query('SET character_set_database = utf8;');
self::$dbAdapter->getConnection()->query('SET character_set_server = utf8;');
return self::$dbAdapter;
}