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


PHP JDatabaseDriver::getServerType方法代码示例

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


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

示例1: __construct

 /**
  * Constructor: builds array of $changeItems by processing the .sql files in a folder.
  * The folder for the Joomla core updates is `administrator/components/com_admin/sql/updates/<database>`.
  *
  * @param   JDatabaseDriver  $db      The current database object
  * @param   string           $folder  The full path to the folder containing the update queries
  *
  * @since   2.5
  */
 public function __construct($db, $folder = null)
 {
     $this->db = $db;
     $this->folder = $folder;
     $updateFiles = $this->getUpdateFiles();
     $updateQueries = $this->getUpdateQueries($updateFiles);
     foreach ($updateQueries as $obj) {
         $changeItem = JSchemaChangeitem::getInstance($db, $obj->file, $obj->updateQuery);
         if ($changeItem->queryType === 'UTF8CNV') {
             // Execute the special update query for utf8mb4 conversion status reset
             try {
                 $this->db->setQuery($changeItem->updateQuery)->execute();
             } catch (RuntimeException $e) {
                 JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');
             }
         } else {
             // Normal change item
             $this->changeItems[] = $changeItem;
         }
     }
     // If on mysql, add a query at the end to check for utf8mb4 conversion status
     $serverType = $this->db->getServerType();
     if ($serverType == 'mysql') {
         // Let the update query be something harmless which should always succeed
         $tmpSchemaChangeItem = JSchemaChangeitem::getInstance($db, 'database.php', 'UPDATE ' . $this->db->quoteName('#__utf8_conversion') . ' SET ' . $this->db->quoteName('converted') . ' = 0;');
         // Set to not skipped
         $tmpSchemaChangeItem->checkStatus = 0;
         // Set the check query
         if ($this->db->hasUTF8mb4Support()) {
             $converted = 2;
             $tmpSchemaChangeItem->queryType = 'UTF8_CONVERSION_UTF8MB4';
         } else {
             $converted = 1;
             $tmpSchemaChangeItem->queryType = 'UTF8_CONVERSION_UTF8';
         }
         $tmpSchemaChangeItem->checkQuery = 'SELECT ' . $this->db->quoteName('converted') . ' FROM ' . $this->db->quoteName('#__utf8_conversion') . ' WHERE ' . $this->db->quoteName('converted') . ' = ' . $converted;
         // Set expected records from check query
         $tmpSchemaChangeItem->checkQueryExpected = 1;
         $tmpSchemaChangeItem->msgElements = array();
         $this->changeItems[] = $tmpSchemaChangeItem;
     }
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:51,代码来源:changeset.php


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