当前位置: 首页>>代码示例>>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;未经允许,请勿转载。