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


PHP Connection::getDatabase方法代码示例

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


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

示例1: getTableNames

 private function getTableNames()
 {
     $tableNames = [];
     foreach ($this->connection->fetchAll('SHOW TABLES') as $row) {
         $tableNames[] = $row['Tables_in_' . $this->connection->getDatabase()];
     }
     return $tableNames;
 }
开发者ID:AlexValGal,项目名称:Practica-FInal-DIW-DWC,代码行数:8,代码来源:SchemaGenerator.php

示例2: getSystemInfo

 /**
  * Returns the system information:
  *  - cpu information
  *  - memory size
  *  - php version
  *  - php accelerator info
  *  - database related info.
  *
  * @return array
  */
 public function getSystemInfo()
 {
     $info = ezcSystemInfo::getInstance();
     $accelerator = false;
     if ($info->phpAccelerator) {
         $accelerator = ['name' => $info->phpAccelerator->name, 'url' => $info->phpAccelerator->url, 'enabled' => $info->phpAccelerator->isEnabled, 'versionString' => $info->phpAccelerator->versionString];
     }
     return ['cpuType' => $info->cpuType, 'cpuSpeed' => $info->cpuSpeed, 'cpuCount' => $info->cpuCount, 'memorySize' => $info->memorySize, 'phpVersion' => phpversion(), 'phpAccelerator' => $accelerator, 'database' => ['type' => $this->connection->getDatabasePlatform()->getName(), 'name' => $this->connection->getDatabase(), 'host' => $this->connection->getHost(), 'username' => $this->connection->getUsername()]];
 }
开发者ID:emodric,项目名称:PlatformUIBundle,代码行数:19,代码来源:SystemInfoHelper.php

示例3: getDsn

 public function getDsn()
 {
     $driver = $this->connection->getDriver()->getName();
     $user = $this->connection->getUsername();
     $pass = $this->connection->getPassword();
     $host = $this->connection->getHost();
     $db = $this->connection->getDatabase();
     return "{$driver}://{$user}:{$pass}@{$host}/{$db}";
 }
开发者ID:jfortunato,项目名称:quickbooks-desktop-bundle,代码行数:9,代码来源:Config.php

示例4: shouldBeRun

 /**
  * {@inheritdoc}
  */
 public function shouldBeRun()
 {
     $schemaManager = $this->connection->getSchemaManager();
     if (!$schemaManager->tablesExist('tl_member')) {
         return false;
     }
     $sql = $this->connection->getDatabasePlatform()->getListTableIndexesSQL('tl_member', $this->connection->getDatabase());
     $index = $this->connection->fetchAssoc($sql . " AND INDEX_NAME = 'username'");
     return '0' !== $index['Non_Unique'];
 }
开发者ID:aschempp,项目名称:contao-installation-bundle,代码行数:13,代码来源:Version350Update.php

示例5: runQueriesFromFile

 protected function runQueriesFromFile($file)
 {
     $queries = array_filter(preg_split('(;\\s*$)m', file_get_contents($file)));
     if (!$this->output->isQuiet()) {
         $this->output->writeln(sprintf("Executing %d queries from %s on database %s", count($queries), $file, $this->db->getDatabase()));
     }
     foreach ($queries as $query) {
         $this->db->exec($query);
     }
 }
开发者ID:nlescure,项目名称:ezpublish-kernel,代码行数:10,代码来源:DbBasedInstaller.php

示例6: getPanel

 /**
  * @return string
  */
 public function getPanel()
 {
     if (empty($this->queries)) {
         return '';
     }
     return $this->renderStyles() . sprintf('<h1>Queries: %s %s, host: %s</h1>', count($this->queries), $this->totalTime ? ', time: ' . sprintf('%0.3f', $this->totalTime * 1000) . ' ms' : '', sprintf('%s%s/%s', $this->connection->getHost(), ($p = $this->connection->getPort()) ? ':' . $p : '', $this->connection->getDatabase())) . '<div class="nette-inner tracy-inner nette-Doctrine2Panel">' . implode('<br>', array_filter(array($this->renderPanelCacheStatistics(), $this->renderPanelQueries()))) . '</div>';
 }
开发者ID:richard-ejem,项目名称:Doctrine,代码行数:10,代码来源:Panel.php

示例7: get_information

 /**
  * Gets array database information
  *
  * @return array
  */
 public function get_information()
 {
     $information = array();
     $information['platform'] = $this->conn->getDatabasePlatform()->getName();
     $information['database'] = $this->conn->getDatabase();
     return $information;
 }
开发者ID:mp-php,项目名称:fuel-packages-dbdocs,代码行数:12,代码来源:dbdocs.php

示例8: listTableForeignKeys

 /**
  * List the foreign keys for the given table
  *
  * @param string $table  The name of the table
  * @return ForeignKeyConstraint[]
  */
 public function listTableForeignKeys($table, $database = null)
 {
     if (is_null($database)) {
         $database = $this->_conn->getDatabase();
     }
     $sql = $this->_platform->getListTableForeignKeysSQL($table, $database);
     $tableForeignKeys = $this->_conn->fetchAll($sql);
     return $this->_getPortableTableForeignKeysList($tableForeignKeys);
 }
开发者ID:jff15,项目名称:travelbot,代码行数:15,代码来源:AbstractSchemaManager.php

示例9: hasOldDatabase

 /**
  * Checks if the database is older than version 3.2.
  *
  * @return bool True if the database is older than version 3.2
  */
 public function hasOldDatabase()
 {
     if (!$this->hasTable('tl_layout')) {
         return false;
     }
     $sql = $this->connection->getDatabasePlatform()->getListTableColumnsSQL('tl_layout', $this->connection->getDatabase());
     $column = $this->connection->fetchAssoc($sql . " AND COLUMN_NAME = 'sections'");
     return 'varchar(1022)' !== $column['Type'];
 }
开发者ID:burguin,项目名称:test02,代码行数:14,代码来源:InstallTool.php

示例10: getStoreFields

 /**
  * Get table fields
  *
  * Info: $schemaManager->listTableColumns($this->tableName) doesn't work if fields are geometries!
  *
  * @throws \Doctrine\DBAL\DBALException
  * @return array field names
  */
 public function getStoreFields()
 {
     $schemaManager = $this->connection->getDriver()->getSchemaManager($this->connection);
     $columns = array();
     $sql = $schemaManager->getDatabasePlatform()->getListTableColumnsSQL($this->tableName, $this->connection->getDatabase());
     foreach ($this->connection->fetchAll($sql) as $fieldInfo) {
         $columns[] = $fieldInfo["field"];
     }
     return $columns;
 }
开发者ID:mapbender,项目名称:data-source,代码行数:18,代码来源:DoctrineBaseDriver.php

示例11: getPanel

 /**
  * @return string
  */
 public function getPanel()
 {
     if (empty($this->queries)) {
         return "";
     }
     $s = "";
     foreach ($this->queries as $query) {
         $s .= $this->processQuery($query);
     }
     $host = sprintf('%s%s/%s', $this->connection->getHost(), ($p = $this->connection->getPort()) ? ':' . $p : '', $this->connection->getDatabase());
     return $this->renderStyles() . '<h1>Queries: ' . count($this->queries) . ($this->totalTime ? ', time: ' . sprintf('%0.3f', $this->totalTime * 1000) . ' ms' : '') . ', host: ' . $host . '</h1>' . '<div class="nette-inner tracy-inner nette-Doctrine2Panel">' . '<table><tr><th>ms</th><th>SQL Statement</th></tr>' . $s . '</table></div>';
 }
开发者ID:pt24,项目名称:doctrine,代码行数:15,代码来源:Panel.php

示例12: metaColumns

 /**
  * Get meta details about a database table in a format known to ZenCart
  *
  * @param  string $table table to get meta details for
  * @return array
  */
 public function metaColumns($table)
 {
     $platform = $this->conn->getDatabasePlatform();
     $dbName = $this->conn->getDatabase();
     $sql = $platform->getListTableColumnsSQL($table, $dbName);
     $meta = array();
     foreach ($this->conn->fetchAll($sql) as $column) {
         $columnInfo = new QueryFactoryMeta($column['Type']);
         $meta[$column['Field']] = $columnInfo;
     }
     return array_change_key_case($meta, CASE_UPPER);
 }
开发者ID:zenmagick,项目名称:zenmagick,代码行数:18,代码来源:QueryFactory.php

示例13: getPanel

 /**
  * @return string
  */
 public function getPanel()
 {
     if (empty($this->queries)) {
         return '';
     }
     $connParams = $this->connection->getParams();
     if ($connParams['driver'] === 'pdo_sqlite' && isset($connParams['path'])) {
         $host = 'path: ' . basename($connParams['path']);
     } else {
         $host = sprintf('host: %s%s/%s', $this->connection->getHost(), ($p = $this->connection->getPort()) ? ':' . $p : '', $this->connection->getDatabase());
     }
     return $this->renderStyles() . sprintf('<h1>Queries: %s %s, %s</h1>', count($this->queries), $this->totalTime ? ', time: ' . sprintf('%0.3f', $this->totalTime * 1000) . ' ms' : '', $host) . '<div class="nette-inner tracy-inner nette-Doctrine2Panel">' . implode('<br>', array_filter([$this->renderPanelCacheStatistics(), $this->renderPanelQueries()])) . '</div>';
 }
开发者ID:LidskaSila,项目名称:Doctrine,代码行数:16,代码来源:Panel.php

示例14: stopQuery

 /**
  * From SQLLogger Doctrine Interface
  */
 public function stopQuery()
 {
     $endTime = microtime(true) - $this->start;
     /**
      * TODO Improve Connection name
      * For now, $this->connection->getDatabase() return the name of the Database
      */
     $this->registerQuery($this->query['sql'], $this->query['params'], $endTime, $this->connection->getDatabase());
     /**
      * This call is helpful to register queries in log file when the application is in debug/local mode
      */
     $this->logger->debug($this->query['sql'] . " [Executed in " . $endTime . " secs.] ", array('params' => $this->query['params'], 'types' => $this->query['types']));
 }
开发者ID:iamsamitdev,项目名称:modalapp,代码行数:16,代码来源:DoctrineDataSource.php

示例15: checkDatabase

 private function checkDatabase()
 {
     try {
         if (!$this->configuredDatabaseExists()) {
             $this->output->writeln(sprintf("The configured database '%s' does not exist. Please run 'php app/console doctrine:database:create' to create the database first", $this->db->getDatabase()));
             exit(self::EXIT_DATABASE_NOT_FOUND_ERROR);
         }
     } catch (ConnectionException $e) {
         $this->output->writeln('An error occured connecting to the database:');
         $this->output->writeln($e->getMessage());
         $this->output->writeln('Please check the database configuration in parameters.yml');
         exit(self::EXIT_GENERAL_DATABASE_ERROR);
     }
 }
开发者ID:sshversioncontrol,项目名称:git-web-client,代码行数:14,代码来源:InstallerCommand.php


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