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


PHP DatabaseBase::tablePrefix方法代码示例

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


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

示例1: changeDBPrefix

 /**
  * @param DatabaseBase $db
  * @param string $prefix
  * @return void
  */
 public static function changeDBPrefix($db, $prefix)
 {
     $db->tablePrefix($prefix);
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:9,代码来源:CloneDatabase.php

示例2: reuseConnection

 /**
  * Mark a foreign connection as being available for reuse under a different
  * DB name or prefix. This mechanism is reference-counted, and must be called
  * the same number of times as getConnection() to work.
  *
  * @param DatabaseBase $conn
  * @throws MWException
  */
 public function reuseConnection($conn)
 {
     $serverIndex = $conn->getLBInfo('serverIndex');
     $refCount = $conn->getLBInfo('foreignPoolRefCount');
     if ($serverIndex === null || $refCount === null) {
         wfDebug(__METHOD__ . ": this connection was not opened as a foreign connection\n");
         /**
          * This can happen in code like:
          *   foreach ( $dbs as $db ) {
          *     $conn = $lb->getConnection( DB_SLAVE, array(), $db );
          *     ...
          *     $lb->reuseConnection( $conn );
          *   }
          * When a connection to the local DB is opened in this way, reuseConnection()
          * should be ignored
          */
         return;
     }
     $dbName = $conn->getDBname();
     $prefix = $conn->tablePrefix();
     if (strval($prefix) !== '') {
         $wiki = "{$dbName}-{$prefix}";
     } else {
         $wiki = $dbName;
     }
     if ($this->mConns['foreignUsed'][$serverIndex][$wiki] !== $conn) {
         throw new MWException(__METHOD__ . ": connection not found, has " . "the connection been freed already?");
     }
     $conn->setLBInfo('foreignPoolRefCount', --$refCount);
     if ($refCount <= 0) {
         $this->mConns['foreignFree'][$serverIndex][$wiki] = $conn;
         unset($this->mConns['foreignUsed'][$serverIndex][$wiki]);
         wfDebug(__METHOD__ . ": freed connection {$serverIndex}/{$wiki}\n");
     } else {
         wfDebug(__METHOD__ . ": reference count for {$serverIndex}/{$wiki} reduced to {$refCount}\n");
     }
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:45,代码来源:LoadBalancer.php

示例3: listTables

 /**
  * @since 1.18
  *
  * @param DatabaseBase $db
  *
  * @return array
  */
 public static function listTables($db)
 {
     $prefix = $db->tablePrefix();
     $tables = $db->listTables($prefix, __METHOD__);
     if ($db->getType() === 'mysql') {
         # bug 43571: cannot clone VIEWs under MySQL
         $views = $db->listViews($prefix, __METHOD__);
         $tables = array_diff($tables, $views);
     }
     array_walk($tables, [__CLASS__, 'unprefixTable'], $prefix);
     // Don't duplicate test tables from the previous fataled run
     $tables = array_filter($tables, [__CLASS__, 'isNotUnittest']);
     if ($db->getType() == 'sqlite') {
         $tables = array_flip($tables);
         // these are subtables of searchindex and don't need to be duped/dropped separately
         unset($tables['searchindex_content']);
         unset($tables['searchindex_segdir']);
         unset($tables['searchindex_segments']);
         $tables = array_flip($tables);
     }
     return $tables;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:29,代码来源:MediaWikiTestCase.php


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