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


PHP DatabaseConnection::sql_select_db方法代碼示例

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


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

示例1: getDatabaseList

 /**
  * Returns list of available databases (with access-check based on username/password)
  *
  * @param bool $initialInstallation TRUE if first installation is in progress, FALSE if upgrading or usual access
  * @return array List of available databases
  */
 protected function getDatabaseList($initialInstallation)
 {
     $this->initializeDatabaseConnection();
     $databaseArray = $this->databaseConnection->admin_get_dbs();
     // Remove mysql organizational tables from database list
     $reservedDatabaseNames = array('mysql', 'information_schema', 'performance_schema');
     $allPossibleDatabases = array_diff($databaseArray, $reservedDatabaseNames);
     // If we are upgrading we show *all* databases the user has access to
     if ($initialInstallation === false) {
         return $allPossibleDatabases;
     } else {
         // In first installation we show all databases but disable not empty ones (with tables)
         $databases = array();
         foreach ($allPossibleDatabases as $database) {
             $this->databaseConnection->setDatabaseName($database);
             $this->databaseConnection->sql_select_db();
             $existingTables = $this->databaseConnection->admin_get_tables();
             $databases[] = array('name' => $database, 'tables' => count($existingTables));
         }
         return $databases;
     }
 }
開發者ID:graurus,項目名稱:testgit_t37,代碼行數:28,代碼來源:DatabaseSelect.php

示例2: selectDatabase

 /**
  * Selects the database depending on TYPO3 version.
  *
  * @param string $databaseName the name of the database to select
  * @param DatabaseConnection $database database object to process the change
  *
  * @return bool
  */
 protected function selectDatabase($databaseName, DatabaseConnection $database)
 {
     $database->setDatabaseName($databaseName);
     $result = $database->sql_select_db();
     return $result;
 }
開發者ID:jacobsenj,項目名稱:phpunit,代碼行數:14,代碼來源:TestCase.php

示例3: selectDbReturnsFalse

 /**
  * @test
  * @expectedException \RuntimeException
  * @expectedExceptionMessage TYPO3 Fatal Error: Cannot connect to the current database, "Foo"!
  * @return void
  */
 public function selectDbReturnsFalse()
 {
     $this->subject->setDatabaseName('Foo');
     $this->assertFalse($this->subject->sql_select_db());
 }
開發者ID:dachcom-digital,項目名稱:TYPO3.CMS,代碼行數:11,代碼來源:DatabaseConnectionTest.php


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