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


PHP DBConnection::getRootConnection方法代码示例

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


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

示例1: __construct

 function __construct()
 {
     // extract version info from configuration file
     $this->config = Config::getInstance();
     $this->myLogger = new Logger("autoUpgrade", $this->config->getEnv("debug_level"));
     $this->current_version = $this->config->getEnv("version_date");
     // connect database with proper permissions
     $this->conn = DBConnection::getRootConnection();
     if ($this->conn->connect_error) {
         throw new Exception("Cannot perform upgrade process: database::dbConnect()");
     }
 }
开发者ID:nedy13,项目名称:AgilityContest,代码行数:12,代码来源:upgradeVersion.php

示例2: restore

 public function restore()
 {
     // we need root database access to re-create tables
     $rconn = DBConnection::getRootConnection();
     if ($rconn->connect_error) {
         throw new Exception("Cannot perform upgrade process: database::dbConnect()");
     }
     session_start();
     unset($_SESSION['progress']);
     session_write_close();
     // phase 1: retrieve file from http request
     $data = $this->retrieveDBFile();
     // phase 2: verify received file
     if (strpos(substr($data, 0, 25), "-- AgilityContest") === FALSE) {
         throw new Exception("Provided file is not an AgilityContest backup file");
     }
     // phase 3: delete all tables and structures from database
     $this->dropAllTables($rconn);
     // phase 4: parse sql file and populate tables into database
     $this->readIntoDB($rconn, $data);
     // phase 5 final tests
     DBConnection::closeConnection($rconn);
     return "";
 }
开发者ID:nedy13,项目名称:AgilityContest,代码行数:24,代码来源:adminFunctions.php

示例3: dropTable

 public function dropTable()
 {
     // To create database we need root DB access
     $rconn = DBConnection::getRootConnection();
     if ($rconn->connect_error) {
         throw new Exception("Cannot perform import process: database::dbConnect()");
     }
     $str = "DROP Table IF EXISTS {$this->tablename};";
     $res = $rconn->query($str);
     if (!$res) {
         $error = $rconn->error;
         $str = "ImportExcel(dogs)::dropTable(): Error deleting temporary table: '{$error}'";
         $this->myLogger->error($str);
         throw new Exception($str);
     }
     return 0;
 }
开发者ID:nedy13,项目名称:AgilityContest,代码行数:17,代码来源:dog_reader.php


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