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


PHP AbstractPlatform::getName方法代碼示例

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


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

示例1: testRequireQueryForServerVersion

 public function testRequireQueryForServerVersion()
 {
     if ($this->platform->getName() != 'informix') {
         $this->markTestSkipped('This test only applies to PDO_INFORMIX');
     }
     $this->assertTrue($this->driverConnection->requiresQueryForServerVersion());
 }
開發者ID:josemalonsom,項目名稱:ifx4dd,代碼行數:7,代碼來源:PDOConnectionTest.php

示例2: testQuoteSingleIdentifier

 /**
  * @group DDC-1360
  */
 public function testQuoteSingleIdentifier()
 {
     if ($this->_platform->getName() == "mssql") {
         $this->markTestSkipped('Not working this way on mssql.');
     }
     $c = $this->_platform->getIdentifierQuoteCharacter();
     $this->assertEquals($c . "test" . $c, $this->_platform->quoteSingleIdentifier("test"));
     $this->assertEquals($c . "test.test" . $c, $this->_platform->quoteSingleIdentifier("test.test"));
     $this->assertEquals(str_repeat($c, 4), $this->_platform->quoteSingleIdentifier($c));
 }
開發者ID:pnaq57,項目名稱:zf2demo,代碼行數:13,代碼來源:AbstractPlatformTestCase.php

示例3: validatePlatform

 /**
  * @param AbstractPlatform $platform
  *
  * @throws UnsupportedPlatformException
  */
 protected function validatePlatform(AbstractPlatform $platform)
 {
     $platformName = $platform->getName();
     if (isset($this->platforms) && !in_array($platformName, $this->platforms)) {
         throw UnsupportedPlatformException::unsupportedPlatform($platformName);
     }
 }
開發者ID:raketman,項目名稱:doctrine2-spatial,代碼行數:12,代碼來源:AbstractGeometryDQLFunction.php

示例4: getSQLDeclaration

 public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
 {
     if ($platform->getName() === 'mysql') {
         return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration) . " " . $platform->getCollationFieldDeclaration('utf8_bin');
     }
     return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration);
 }
開發者ID:luisbrito,項目名稱:Phraseanet,代碼行數:7,代碼來源:BinaryString.php

示例5: convertToDatabaseValueSQL

 /**
  * @param string $sqlExpr
  * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
  * @throws \Kdyby\Doctrine\NotImplementedException
  * @return string
  */
 public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
 {
     if (!$platform instanceof Doctrine\DBAL\Platforms\MySqlPlatform) {
         throw new Kdyby\Doctrine\NotImplementedException("Unsupported platform " . $platform->getName());
     }
     return 'GeomFromText(' . $sqlExpr . ')';
 }
開發者ID:Richmond77,項目名稱:learning-nette,代碼行數:13,代碼來源:GeometryType.php

示例6: getSQLDeclaration

 /**
  * {@inheritdoc}
  */
 public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
 {
     if ($platform->getName() === 'postgresql') {
         return 'GEOMETRY';
     }
     return strtoupper($this->getName());
 }
開發者ID:brick,項目名稱:geo,代碼行數:10,代碼來源:GeometryType.php

示例7: getSQLDeclaration

 /** {@inheritdoc} */
 public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
 {
     switch ($platform->getName()) {
         case 'mysql':
             return 'TINYINT' . (isset($fieldDeclaration['unsigned']) && $fieldDeclaration['unsigned'] ? ' UNSIGNED' : '');
         default:
             return $platform->getSmallIntTypeDeclarationSQL($fieldDeclaration);
     }
 }
開發者ID:ntd1712,項目名稱:common,代碼行數:10,代碼來源:TinyIntType.php

示例8: walkSelectStatement

 /**
  * Walks down a SelectStatement AST node, wrapping it in a COUNT (SELECT DISTINCT).
  *
  * Note that the ORDER BY clause is not removed. Many SQL implementations (e.g. MySQL)
  * are able to cache subqueries. By keeping the ORDER BY clause intact, the limitSubQuery
  * that will most likely be executed next can be read from the native SQL cache.
  *
  * @param SelectStatement $AST
  *
  * @return string
  *
  * @throws \RuntimeException
  */
 public function walkSelectStatement(SelectStatement $AST)
 {
     if ($this->platform->getName() === "mssql") {
         $AST->orderByClause = null;
     }
     $sql = parent::walkSelectStatement($AST);
     // Find out the SQL alias of the identifier column of the root entity
     // It may be possible to make this work with multiple root entities but that
     // would probably require issuing multiple queries or doing a UNION SELECT
     // so for now, It's not supported.
     // Get the root entity and alias from the AST fromClause
     $from = $AST->fromClause->identificationVariableDeclarations;
     if (count($from) > 1) {
         throw new \RuntimeException("Cannot count query which selects two FROM components, cannot make distinction");
     }
     $fromRoot = reset($from);
     $rootAlias = $fromRoot->rangeVariableDeclaration->aliasIdentificationVariable;
     $rootClass = $this->queryComponents[$rootAlias]['metadata'];
     $rootIdentifier = $rootClass->identifier;
     // For every identifier, find out the SQL alias by combing through the ResultSetMapping
     $sqlIdentifier = [];
     foreach ($rootIdentifier as $property) {
         if (isset($rootClass->fieldMappings[$property])) {
             foreach (array_keys($this->rsm->fieldMappings, $property) as $alias) {
                 if ($this->rsm->columnOwnerMap[$alias] == $rootAlias) {
                     $sqlIdentifier[$property] = $alias;
                 }
             }
         }
         if (isset($rootClass->associationMappings[$property])) {
             $joinColumn = $rootClass->associationMappings[$property]['joinColumns'][0]['name'];
             foreach (array_keys($this->rsm->metaMappings, $joinColumn) as $alias) {
                 if ($this->rsm->columnOwnerMap[$alias] == $rootAlias) {
                     $sqlIdentifier[$property] = $alias;
                 }
             }
         }
     }
     if (count($rootIdentifier) != count($sqlIdentifier)) {
         throw new \RuntimeException(sprintf('Not all identifier properties can be found in the ResultSetMapping: %s', implode(', ', array_diff($rootIdentifier, array_keys($sqlIdentifier)))));
     }
     // Build the counter query
     return sprintf('SELECT %s AS dctrn_count FROM (SELECT DISTINCT %s FROM (%s) dctrn_result) dctrn_table', $this->platform->getCountExpression('*'), implode(', ', $sqlIdentifier), $sql);
 }
開發者ID:AdactiveSAS,項目名稱:doctrine2,代碼行數:57,代碼來源:CountOutputWalker.php

示例9: create

 public function create($formatter, Platform $platform, $options = array())
 {
     $formatter = strtolower($formatter);
     if (isset(self::$formatters[$formatter]) === false) {
         throw new EngineException('Formatter does not exist at::' . $formatter);
     }
     $class = new self::$formatters[$formatter]($this->event, $this->writer->getWriter($platform->getName(), $formatter), $platform, $this->visitor, $options);
     # register this formatter as a subscriber
     $this->event->addSubscriber($class);
     return $class;
 }
開發者ID:icomefromthenet,項目名稱:faker,代碼行數:11,代碼來源:FormatterFactory.php

示例10: getHandler

 /**
  * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
  * @return \Doctrine\Spatial\DBAL\HandlerInterface 
  */
 public function getHandler(AbstractPlatform $platform)
 {
     $name = $platform->getName();
     if (isset($this->handlerMap[$name])) {
         return $this->handlerMap[$name];
     }
     if (!isset($this->handlerClasses[$name])) {
         throw new \RuntimeException('The database platform ' . $name . ' is not supported');
     }
     return $this->handlerMap[$name] = new $this->handlerClasses[$name]();
 }
開發者ID:nvdnkpr,項目名稱:doctrine-spatial-sandbox,代碼行數:15,代碼來源:SchemaEventSubscriber.php

示例11: createOroSearchIndexTextTable

 /**
  * Create oro_search_index_text table
  *
  * @param Schema $schema
  */
 protected function createOroSearchIndexTextTable(Schema $schema)
 {
     $table = $schema->createTable('oro_search_index_text');
     $table->addColumn('id', 'integer', ['autoincrement' => true]);
     $table->addColumn('item_id', 'integer', []);
     $table->addColumn('field', 'string', ['length' => 250]);
     $table->addColumn('value', 'text', []);
     $table->addIndex(['item_id'], 'idx_a0243539126f525e', []);
     $table->setPrimaryKey(['id']);
     if ($this->platform->getName() === DatabasePlatformInterface::DATABASE_MYSQL) {
         $table->addOption('engine', PdoMysql::ENGINE_MYISAM);
     }
 }
開發者ID:xamin123,項目名稱:platform,代碼行數:18,代碼來源:OroSearchBundleInstaller.php

示例12: getSqlDeclaration

 /**
  * @param array            $fieldDeclaration
  * @param AbstractPlatform $platform
  *
  * @throws DBALException
  *
  * @return string
  */
 public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
 {
     if ($platform instanceof DB2Platform or $platform instanceof OraclePlatform or $platform instanceof SqlitePlatform or $platform instanceof SQLServerPlatform) {
         throw new DBALException('ENUMs are not supported by ' . $platform->getName() . '.');
     }
     if (!empty($fieldDeclaration['values']) && is_array($fieldDeclaration['values'])) {
         $values = array();
         foreach ($fieldDeclaration['values'] as $value) {
             $values[] = $platform->quoteStringLiteral($value);
         }
         return 'ENUM (' . implode(',', $values) . ')';
     }
 }
開發者ID:shmaltorhbooks,項目名稱:doctrine-enum,代碼行數:21,代碼來源:EnumType.php

示例13: getSqlDeclaration

 public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
 {
     $values = implode(", ", array_map(function ($val) {
         return "'" . $val . "'";
     }, static::getValues()));
     if ($platform instanceof MysqlPlatform) {
         return sprintf('ENUM(%s)', $values);
     } elseif ($platform instanceof SqlitePlatform) {
         return sprintf('TEXT CHECK(%s IN (%s))', $fieldDeclaration['name'], $values);
     } elseif ($platform instanceof PostgreSqlPlatform) {
         return sprintf('VARCHAR(255) CHECK(%s IN (%s))', $fieldDeclaration['name'], $values);
     } else {
         throw new \Exception(sprintf("Sorry, platform %s currently not supported enums", $platform->getName()));
     }
 }
開發者ID:simpleci,項目名稱:frontend,代碼行數:15,代碼來源:Enum.php

示例14: getOutput

 /**
  * Dump the statistics of executed queries
  *
  * @param boolean $dumpOnlySql
  * @return void
  */
 public function getOutput($dumpOnlySql = false)
 {
     $output = '';
     if (!$dumpOnlySql) {
         $output .= 'Platform: ' . $this->platform->getName() . PHP_EOL;
         $output .= 'Executed queries: ' . count($this->queries) . ', total time: ' . $this->totalExecutionTime . ' ms' . PHP_EOL;
     }
     foreach ($this->queries as $index => $sql) {
         if (!$dumpOnlySql) {
             $output .= 'Query(' . ($index + 1) . ') - ' . $this->queryExecutionTimes[$index] . ' ms' . PHP_EOL;
         }
         $output .= $sql . ';' . PHP_EOL;
     }
     $output .= PHP_EOL;
     return $output;
 }
開發者ID:justus-alex,項目名稱:TaxiPrize,代碼行數:22,代碼來源:QueryAnalyzer.php

示例15: sqlXpathComparePropertyValue

 /**
  * @param $alias
  * @param $property
  * @param $value
  * @param string $operator
  *
  * @return string
  *
  * @throws NotImplementedException if the storage backend is neither mysql
  *      nor postgres nor sqlite
  */
 private function sqlXpathComparePropertyValue($alias, $property, $value, $operator)
 {
     $expression = null;
     if ($this->platform instanceof MySqlPlatform) {
         $expression = "EXTRACTVALUE({$alias}.props, 'count(//sv:property[@sv:name=\"" . $property . "\"]/sv:value[text()%s%s]) > 0')";
         // mysql does not escape the backslashes for us, while postgres and sqlite do
         $value = Xpath::escapeBackslashes($value);
     } elseif ($this->platform instanceof PostgreSqlPlatform) {
         $expression = "xpath_exists('//sv:property[@sv:name=\"" . $property . "\"]/sv:value[text()%s%s]', CAST({$alias}.props AS xml), " . $this->sqlXpathPostgreSQLNamespaces() . ") = 't'";
     } elseif ($this->platform instanceof SqlitePlatform) {
         $expression = "EXTRACTVALUE({$alias}.props, 'count(//sv:property[@sv:name=\"" . $property . "\"]/sv:value[text()%s%s]) > 0')";
     } else {
         throw new NotImplementedException("Xpath evaluations cannot be executed with '" . $this->platform->getName() . "' yet.");
     }
     return sprintf($expression, $this->walkOperator($operator), Xpath::escape($value));
 }
開發者ID:richard-fizz,項目名稱:jackalope-doctrine-dbal,代碼行數:27,代碼來源:QOMWalker.php


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