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


PHP OA_DB::createDatabase方法代码示例

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


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

示例1: setupDB

 /**
  * A method for setting up a test database.
  *
  * @param bool $ignore_errors True if setup errors should be ignored.
  */
 static function setupDB($ignore_errors = false)
 {
     $oDbh =& OA_DB::singleton();
     if (PEAR::isError($oDbh)) {
         $aConf = $GLOBALS['_MAX']['CONF'];
         $result = OA_DB::createDatabase($aConf['database']['name']);
         if (PEAR::isError($result) && !$ignore_errors) {
             PEAR::raiseError("TestEnv unable to create the {$aConf['database']['name']} test database." . $result->getUserInfo(), PEAR_LOG_ERR);
             die(1);
         }
         $result = OA_DB::createFunctions();
         if (PEAR::isError($result) && !$ignore_errors) {
             PEAR::raiseError("TestEnv unable to create the required functions." . $result->getUserInfo(), PEAR_LOG_ERR);
             die(1);
         }
     }
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:22,代码来源:TestEnv.php

示例2: _createDatabase

 /**
  * create the empty database
  *
  * @return boolean
  */
 function _createDatabase($aDsn = '')
 {
     if ($aDsn) {
         $this->aDsn = $aDsn;
     }
     $GLOBALS['_MAX']['CONF']['database'] = $this->aDsn['database'];
     $GLOBALS['_MAX']['CONF']['table']['prefix'] = $this->aDsn['table']['prefix'];
     $GLOBALS['_MAX']['CONF']['table']['type'] = $this->aDsn['table']['type'];
     // Try connecting to the database
     $this->oDbh =& OA_DB::singleton(OA_DB::getDsn($this->aDsn));
     if (PEAR::isError($this->oDbh)) {
         $GLOBALS['_OA']['CONNECTIONS'] = array();
         $GLOBALS['_MDB2_databases'] = array();
         if (PEAR::isError($result)) {
             $this->oLogger->logError($result->getMessage());
             $this->oLogger->logErrorUnlessEmpty($result->getUserInfo());
             return false;
         }
         //attempt to create DB
         $result = OA_DB::createDatabase($this->aDsn['database']['name']);
         if (PEAR::isError($result)) {
             $this->oLogger->logError($result->getMessage());
             $this->oLogger->logErrorUnlessEmpty($result->getUserInfo());
             return false;
         }
         $this->oDbh = OA_DB::changeDatabase($this->aDsn['database']['name']);
         if (PEAR::isError($this->oDbh)) {
             $this->oLogger->logError($this->oDbh->getMessage());
             $this->oLogger->logErrorUnlessEmpty($this->getUserInfo());
             $this->oDbh = null;
             return false;
         }
         $this->oLogger->log('Database created ' . $this->aDsn['database']['name']);
         $this->can_drop_database = true;
     }
     $result = OA_DB::createFunctions();
     if (PEAR::isError($result)) {
         $this->oLogger->logError($result->getMessage());
         return false;
     }
     return true;
 }
开发者ID:villos,项目名称:tree_admin,代码行数:47,代码来源:Upgrade.php


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