當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MDB2_Driver_Common::getDebugOutput方法代碼示例

本文整理匯總了PHP中MDB2_Driver_Common::getDebugOutput方法的典型用法代碼示例。如果您正苦於以下問題:PHP MDB2_Driver_Common::getDebugOutput方法的具體用法?PHP MDB2_Driver_Common::getDebugOutput怎麽用?PHP MDB2_Driver_Common::getDebugOutput使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MDB2_Driver_Common的用法示例。


在下文中一共展示了MDB2_Driver_Common::getDebugOutput方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createDbFromStructure

 /**
  * @brief Creates tables from XML file
  * @param string $file file to read structure from
  * @return bool
  *
  * TODO: write more documentation
  */
 public static function createDbFromStructure($file)
 {
     $CONFIG_DBNAME = OC_Config::getValue("dbname", "owncloud");
     $CONFIG_DBTABLEPREFIX = OC_Config::getValue("dbtableprefix", "oc_");
     $CONFIG_DBTYPE = OC_Config::getValue("dbtype", "sqlite");
     // cleanup the cached queries
     self::$preparedQueries = array();
     self::connectScheme();
     // read file
     $content = file_get_contents($file);
     // Make changes and save them to an in-memory file
     $file2 = 'static://db_scheme';
     $content = str_replace('*dbname*', $CONFIG_DBNAME, $content);
     $content = str_replace('*dbprefix*', $CONFIG_DBTABLEPREFIX, $content);
     /* FIXME: use CURRENT_TIMESTAMP for all databases. mysql supports it as a default for DATETIME since 5.6.5 [1]
      * as a fallback we could use <default>0000-01-01 00:00:00</default> everywhere
      * [1] http://bugs.mysql.com/bug.php?id=27645
      * http://dev.mysql.com/doc/refman/5.0/en/timestamp-initialization.html
      * http://www.postgresql.org/docs/8.1/static/functions-datetime.html
      * http://www.sqlite.org/lang_createtable.html
      * http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions037.htm
      */
     if ($CONFIG_DBTYPE == 'pgsql') {
         //mysql support it too but sqlite doesn't
         $content = str_replace('<default>0000-00-00 00:00:00</default>', '<default>CURRENT_TIMESTAMP</default>', $content);
     }
     file_put_contents($file2, $content);
     // Try to create tables
     $definition = self::$schema->parseDatabaseDefinitionFile($file2);
     //clean up memory
     unlink($file2);
     // Die in case something went wrong
     if ($definition instanceof MDB2_Schema_Error) {
         OC_Template::printErrorPage($definition->getMessage() . ': ' . $definition->getUserInfo());
     }
     if (OC_Config::getValue('dbtype', 'sqlite') === 'oci') {
         unset($definition['charset']);
         //or MDB2 tries SHUTDOWN IMMEDIATE
         $oldname = $definition['name'];
         $definition['name'] = OC_Config::getValue("dbuser", $oldname);
     }
     // we should never drop a database
     $definition['overwrite'] = false;
     $ret = self::$schema->createDatabase($definition);
     // Die in case something went wrong
     if ($ret instanceof MDB2_Error) {
         OC_Template::printErrorPage(self::$MDB2->getDebugOutput() . ' ' . $ret->getMessage() . ': ' . $ret->getUserInfo());
     }
     return true;
 }
開發者ID:CDN-Sparks,項目名稱:owncloud,代碼行數:57,代碼來源:db.php


注:本文中的MDB2_Driver_Common::getDebugOutput方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。