當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。