当前位置: 首页>>代码示例>>PHP>>正文


PHP Elite_Vaf_Helper_Data::dbAdapter方法代码示例

本文整理汇总了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;
 }
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:39,代码来源:Elite_Vaf_Helper_Data.php


注:本文中的Elite_Vaf_Helper_Data::dbAdapter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。