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


PHP Zend_Db_Adapter_Abstract::isConnected方法代码示例

本文整理汇总了PHP中Zend_Db_Adapter_Abstract::isConnected方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Adapter_Abstract::isConnected方法的具体用法?PHP Zend_Db_Adapter_Abstract::isConnected怎么用?PHP Zend_Db_Adapter_Abstract::isConnected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Db_Adapter_Abstract的用法示例。


在下文中一共展示了Zend_Db_Adapter_Abstract::isConnected方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCurrentSchemaVersion

 public function getCurrentSchemaVersion()
 {
     if (empty($this->_module)) {
         throw new FFR_Exception('Module was empty.  A module must be set.');
     }
     $cache = Zend_Controller_Action_HelperBroker::getStaticHelper('Cache')->getManager()->getCache('database');
     if (!($version = $cache->load($this->_module . 'Version'))) {
         // Ensure we have valid connection to the database
         if (!$this->_db->isConnected()) {
             $this->_db->getServerVersion();
         }
         $sql = 'SELECT schema_version FROM ' . $this->_schemaVersionTable . ' WHERE schema_module = "' . $this->_module . '"';
         $version = null;
         try {
             $version = $this->_db->fetchOne($sql);
         } catch (Zend_Db_Exception $e) {
             // exception means that the schema version table doesn't exist, so create it
             $createSql = "CREATE TABLE {$this->_schemaVersionTable} (\n                                schema_id INT NOT NULL AUTO_INCREMENT,\n                                schema_version INT NOT NULL,\n                                schema_module VARCHAR(50),\n                                PRIMARY KEY (schema_id)\n                            )";
             $this->_db->query($createSql);
         }
         // There isn't a version record so lets make one
         if ($version === null || $version === false) {
             $insertSql = "INSERT  {$this->_schemaVersionTable} SET schema_version = 0," . ' schema_module = "' . $this->_module . '"';
             $this->_db->query($insertSql);
             $version = $this->_db->fetchOne($sql);
         }
         $cache->save($version, $this->_module . 'Version', array('schemaVersion'));
     }
     return $version;
 }
开发者ID:rantoine,项目名称:AdvisorIllustrator,代码行数:30,代码来源:Manager.php

示例2: __construct

 public function __construct(Zend_Db_Adapter_Abstract $adapter, $options = array())
 {
     if (!$adapter->isConnected()) {
         throw new Khcn_Exception('Adapter not connected');
     }
     $this->_adapter = $adapter;
     if (is_array($options)) {
         $this->setOptions($options);
     }
 }
开发者ID:nhochong,项目名称:qlkh-sgu,代码行数:10,代码来源:Export.php

示例3: getCurrentSchemaVersion

 function getCurrentSchemaVersion()
 {
     // Ensure we have valid connection to the database
     if (!$this->_db->isConnected()) {
         $this->_db->getServerVersion();
     }
     $schemaVersionTableName = $this->getPrefixedSchemaVersionTableName();
     $sql = "SELECT version FROM " . $schemaVersionTableName;
     try {
         $version = $this->_db->fetchOne($sql);
     } catch (Exception $e) {
         // exception means that the schema version table doesn't exist, so create it
         $createSql = "CREATE TABLE {$schemaVersionTableName} ( \n                version bigint NOT NULL,\n                PRIMARY KEY (version)\n            )";
         $this->_db->query($createSql);
         $insertSql = "INSERT INTO {$schemaVersionTableName} (version) VALUES (0)";
         $this->_db->query($insertSql);
         $version = $this->_db->fetchOne($sql);
     }
     return $version;
 }
开发者ID:nemgue,项目名称:Akrabat,代码行数:20,代码来源:Manager.php

示例4: openConnection

 public function openConnection()
 {
     if (!self::$dbAdapter) {
         $bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
         $options = $bootstrap->getOptions();
         try {
             self::$dbAdapter = Zend_Db::factory($options['database']['adapter'], ['host' => $options['database']['params']['host'], 'username' => $options['database']['params']['username'], 'password' => $options['database']['params']['password'], 'dbname' => $options['database']['params']['dbname']]);
             if (!self::$dbAdapter->isConnected()) {
                 //$this->closeConnection();
                 //throw new PDOException;
             }
         } catch (PDOException $pdo) {
             die('<div class="big huge">
                    <span class="icon-warning-sign"></span>
                    <h1>feader reached the maximum limit of parallel users</h1>
                    <h2>We\'re working hard to fix this. Please come back later!</h2>
                 </div>');
         }
     }
     $this->_db = self::$dbAdapter;
     $this->_db->query('SET NAMES utf8');
 }
开发者ID:schaechinger,项目名称:feader,代码行数:22,代码来源:RepositoryAbstract.php

示例5: isConnected

 /**
  * Test if a connection is active
  *
  * @return boolean
  */
 public function isConnected()
 {
     return $this->_adapter->isConnected();
 }
开发者ID:cwcw,项目名称:cms,代码行数:9,代码来源:Abstract.php


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