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


PHP DBManager::instance方法代码示例

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


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

示例1: action_index

 public function action_index()
 {
     //$db = new Database;
     $dbmanager = DBManager::instance();
     //echo $dbmanager->get_version();
     //echo $dbmanager->total_tables();
     // List tables
     //echo '==================<br />List tables<br />==================';
     //$tables = $dbmanager->list_tables();
     //echo Kohana::debug($tables);
     // Only list name of tables
     //echo '==================<br />Only list name of tables<br />==================';
     //$table_name = $db->list_tables();
     //echo Kohana::debug($table_name);
     // List backup files
     //echo '==================<br />List backup files<br />==================';
     //echo Kohana::debug($dbmanager->list_backfiles());
     // Optimize Tables
     //echo '==================<br />Optimize Tables<br />==================<br />';
     //$result = $dbmanager->optimize_tables($table_name);
     //if ( !empty($result) )
     //	echo $result;
     //else
     //	echo '全部优化完毕';
     echo '==================<br />Backup Tables<br />==================<br />';
     echo 'Next Backup time: ' . $dbmanager->next_backup_time() . '<br />';
     echo Kohana::debug($dbmanager->backup_db());
     // Download backup file. $filename = '1234567890_-_database.sql'
     // $dbmanager->download_backup($filename);
     // Delete backup file. $filename = '1234567890_-_database.sql'
     // $dbmanager->delete_backup($filename);
     // Display the demo page
     //$this->template->title = 'Database Manager';
     //$this->template->content = ;
 }
开发者ID:bogus115,项目名称:kohana-fans-cn,代码行数:35,代码来源:demo.php

示例2: getInstance

 /**
  * This method returns the singleton instance of this class.
  *
  * @return DBManager  the singleton instance
  */
 public static function getInstance()
 {
     if (is_null(DBManager::$instance)) {
         DBManager::$instance = new DBManager();
     }
     return DBManager::$instance;
 }
开发者ID:ratbird,项目名称:hope,代码行数:12,代码来源:DBManager.class.php

示例3: getInstance

 /**
  * Gives PDO database instance. Singleton implementation
  *
  * @throws PDOException
  * @return PDO
  */
 public static function getInstance()
 {
     if (!self::$instance instanceof PDO) {
         $dsn = self::getMysqlDSN();
         $host = Configuration::get(Configuration::DB_HOST);
         $user = Configuration::get(Configuration::DB_USER);
         $pass = Configuration::get(Configuration::DB_PASS);
         $name = Configuration::get(Configuration::DB_NAME);
         try {
             Logger::getLogger()->LogDebug('New DB Instance created');
             self::$instance = new PDO($dsn, $user, $pass);
             self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         } catch (PDOException $e) {
             Logger::getLogger()->LogFatal($e->getMessage());
         }
     }
     return self::$instance;
 }
开发者ID:Abhishek627,项目名称:crux,代码行数:24,代码来源:DBManager.php


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