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


PHP AdapterInterface::getPlatform方法代码示例

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


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

示例1: logQuery

 /**
  * Sends event for a logger to write down query text
  * @param mixed $select
  */
 protected function logQuery($select)
 {
     if ($select instanceof Select) {
         $platform = $this->dbAdapter->getPlatform();
         $query = $select->getSqlString($platform);
     } else {
         $query = json_encode($select);
     }
     $this->getEventManager()->trigger(\Application\Utils\Events::LOG_SQL_QUERY, $this, compact('query'));
 }
开发者ID:FiftyNine,项目名称:ScpperDB,代码行数:14,代码来源:ZendDbSqlMapper.php

示例2: __construct

 public function __construct(AdapterInterface $adapter)
 {
     $this->adapter = $adapter;
     $platform = $adapter->getPlatform();
     switch (strtolower($platform->getName())) {
         case 'mysql':
             $platform = new Mysql\Mysql();
             $this->decorators = $platform->decorators;
             break;
         case 'sqlserver':
             $platform = new SqlServer\SqlServer();
             $this->decorators = $platform->decorators;
             break;
         case 'oracle':
             $platform = new Oracle\Oracle();
             $this->decorators = $platform->decorators;
             break;
         case 'ibm db2':
         case 'ibm_db2':
         case 'ibmdb2':
             $platform = new IbmDb2\IbmDb2();
             $this->decorators = $platform->decorators;
         default:
     }
 }
开发者ID:tillk,项目名称:vufind,代码行数:25,代码来源:Platform.php

示例3: getSqlStringForSqlObject

 /**
  * Get sql string using platform or sql object
  *
  * @param SqlInterface      $sqlObject
  * @param PlatformInterface $platform
  *
  * @return string
  */
 public function getSqlStringForSqlObject(SqlInterface $sqlObject, PlatformInterface $platform = null)
 {
     $platform = $platform ?: $this->adapter->getPlatform();
     if ($this->sqlPlatform) {
         $this->sqlPlatform->setSubject($sqlObject);
         return $this->sqlPlatform->getSqlString($platform);
     }
     return $sqlObject->getSqlString($platform);
 }
开发者ID:tillk,项目名称:vufind,代码行数:17,代码来源:Sql.php

示例4: prepareStatement

 /**
  * {@inheritDoc}
  *
  * @return StatementContainerInterface
  */
 public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer)
 {
     $parameterContainer = $statementContainer->getParameterContainer();
     if (!$parameterContainer instanceof ParameterContainer) {
         $parameterContainer = new ParameterContainer();
         $statementContainer->setParameterContainer($parameterContainer);
     }
     $statementContainer->setSql($this->buildSqlString($adapter->getPlatform(), $adapter->getDriver(), $parameterContainer));
     return $statementContainer;
 }
开发者ID:zendframework,项目名称:zend-db,代码行数:15,代码来源:AbstractPreparableSql.php

示例5: __construct

 public function __construct(AdapterInterface $adapter)
 {
     $this->adapter = $adapter;
     $platform = $adapter->getPlatform();
     switch (strtolower($platform->getName())) {
         case 'mysql':
             $platform = new ZfPlatform\Mysql\Mysql();
             $this->decorators = $platform->decorators;
             $this->setTypeDecorator('Zend\\Db\\Sql\\Select', new Mysql\SelectDecorator());
             break;
         case 'sqlserver':
             $platform = new ZfPlatform\SqlServer\SqlServer();
             $this->decorators = $platform->decorators;
             $this->setTypeDecorator('Zend\\Db\\Sql\\Select', new SqlServer\SelectDecorator());
             break;
         case 'oracle':
             $platform = new ZfPlatform\Oracle\Oracle();
             $this->decorators = $platform->decorators;
             $this->setTypeDecorator('Zend\\Db\\Sql\\Select', new Oracle\SelectDecorator());
             break;
         default:
     }
 }
开发者ID:railsphp,项目名称:framework,代码行数:23,代码来源:Platform.php

示例6: prepareStatement

 /**
  * Prepare statement
  *
  * @param  AdapterInterface $adapter
  * @param  StatementContainerInterface $statementContainer
  * @return void
  */
 public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer)
 {
     $driver = $adapter->getDriver();
     $platform = $adapter->getPlatform();
     $parameterContainer = $statementContainer->getParameterContainer();
     if (!$parameterContainer instanceof ParameterContainer) {
         $parameterContainer = new ParameterContainer();
         $statementContainer->setParameterContainer($parameterContainer);
     }
     $table = $this->table;
     $schema = null;
     // create quoted table name to use in insert processing
     if ($table instanceof TableIdentifier) {
         list($table, $schema) = $table->getTableAndSchema();
     }
     $table = $platform->quoteIdentifier($table);
     if ($schema) {
         $table = $platform->quoteIdentifier($schema) . $platform->getIdentifierSeparator() . $table;
     }
     $columns = array();
     $values = array();
     foreach ($this->columns as $cIndex => $column) {
         $columns[$cIndex] = $platform->quoteIdentifier($column);
         if (isset($this->values[$cIndex]) && $this->values[$cIndex] instanceof Expression) {
             $exprData = $this->processExpression($this->values[$cIndex], $platform, $driver);
             $values[$cIndex] = $exprData->getSql();
             $parameterContainer->merge($exprData->getParameterContainer());
         } else {
             $values[$cIndex] = $driver->formatParameterName($column);
             if (isset($this->values[$cIndex])) {
                 $parameterContainer->offsetSet($column, $this->values[$cIndex]);
             } else {
                 $parameterContainer->offsetSet($column, null);
             }
         }
     }
     $sql = sprintf($this->specifications[self::SPECIFICATION_INSERT], $table, implode(', ', $columns), implode(', ', $values));
     $statementContainer->setSql($sql);
 }
开发者ID:zhangyuxiao,项目名称:qoros,代码行数:46,代码来源:Insert.php

示例7: prepareStatement

 /**
  * Prepare statement
  *
  * @param AdapterInterface $adapter
  * @param StatementContainerInterface $statementContainer
  * @return void
  */
 public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer)
 {
     $driver = $adapter->getDriver();
     $platform = $adapter->getPlatform();
     $parameterContainer = $statementContainer->getParameterContainer();
     if (!$parameterContainer instanceof ParameterContainer) {
         $parameterContainer = new ParameterContainer();
         $statementContainer->setParameterContainer($parameterContainer);
     }
     $table = $this->table;
     $schema = null;
     // create quoted table name to use in update processing
     if ($table instanceof TableIdentifier) {
         list($table, $schema) = $table->getTableAndSchema();
     }
     $table = $platform->quoteIdentifier($table);
     if ($schema) {
         $table = $platform->quoteIdentifier($schema) . $platform->getIdentifierSeparator() . $table;
     }
     $set = $this->set;
     if (is_array($set)) {
         $setSql = array();
         foreach ($set as $column => $value) {
             if ($value instanceof Expression) {
                 $exprData = $this->processExpression($value, $platform, $driver);
                 $setSql[] = $platform->quoteIdentifier($column) . ' = ' . $exprData->getSql();
                 $parameterContainer->merge($exprData->getParameterContainer());
             } else {
                 $setSql[] = $platform->quoteIdentifier($column) . ' = ' . $driver->formatParameterName($column);
                 $parameterContainer->offsetSet($column, $value);
             }
         }
         $set = implode(', ', $setSql);
     }
     $sql = sprintf($this->specifications[static::SPECIFICATION_UPDATE], $table, $set);
     // process where
     if ($this->where->count() > 0) {
         $whereParts = $this->processExpression($this->where, $platform, $driver, 'where');
         $parameterContainer->merge($whereParts->getParameterContainer());
         $sql .= ' ' . sprintf($this->specifications[static::SPECIFICATION_WHERE], $whereParts->getSql());
     }
     $statementContainer->setSql($sql);
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:50,代码来源:Update.php

示例8: buildSqlString

 /**
  * @param SqlInterface     $sqlObject
  * @param AdapterInterface $adapter
  *
  * @return string
  *
  * @throws Exception\InvalidArgumentException
  */
 public function buildSqlString(SqlInterface $sqlObject, AdapterInterface $adapter = null)
 {
     return $this->sqlPlatform->setSubject($sqlObject)->getSqlString($adapter ? $adapter->getPlatform() : $this->adapter->getPlatform());
 }
开发者ID:karnurik,项目名称:zf2-turtorial,代码行数:12,代码来源:Sql.php

示例9: prepareStatement

 /**
  * Prepare the delete statement
  *
  * @param  AdapterInterface $adapter
  * @param  StatementContainerInterface $statementContainer
  * @return void
  */
 public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer)
 {
     $driver = $adapter->getDriver();
     $platform = $adapter->getPlatform();
     $parameterContainer = $statementContainer->getParameterContainer();
     if (!$parameterContainer instanceof ParameterContainer) {
         $parameterContainer = new ParameterContainer();
         $statementContainer->setParameterContainer($parameterContainer);
     }
     $table = $this->table;
     $schema = null;
     // create quoted table name to use in delete processing
     if ($table instanceof TableIdentifier) {
         list($table, $schema) = $table->getTableAndSchema();
     }
     $table = $platform->quoteIdentifier($table);
     if ($schema) {
         $table = $platform->quoteIdentifier($schema) . $platform->getIdentifierSeparator() . $table;
     }
     $sql = sprintf($this->specifications[static::SPECIFICATION_DELETE], $table);
     // process where
     if ($this->where->count() > 0) {
         $whereParts = $this->processExpression($this->where, $platform, $driver, 'where');
         $parameterContainer->merge($whereParts->getParameterContainer());
         $sql .= ' ' . sprintf($this->specifications[static::SPECIFICATION_WHERE], $whereParts->getSql());
     }
     $statementContainer->setSql($sql);
 }
开发者ID:tejdeeps,项目名称:tejcs.com,代码行数:35,代码来源:Delete.php

示例10: prepareStatement

 /**
  * Prepare statement
  *
  * @param AdapterInterface $adapter
  * @param StatementContainerInterface $statementContainer
  * @return void
  */
 public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer)
 {
     // ensure statement has a ParameterContainer
     $parameterContainer = $statementContainer->getParameterContainer();
     if (!$parameterContainer instanceof ParameterContainer) {
         $parameterContainer = new ParameterContainer();
         $statementContainer->setParameterContainer($parameterContainer);
     }
     $sqls = array();
     $parameters = array();
     $platform = $adapter->getPlatform();
     $driver = $adapter->getDriver();
     foreach ($this->specifications as $name => $specification) {
         $parameters[$name] = $this->{'process' . $name}($platform, $driver, $parameterContainer, $sqls, $parameters);
         if ($specification && is_array($parameters[$name])) {
             $sqls[$name] = $this->createSqlFromSpecificationAndParameters($specification, $parameters[$name]);
         }
     }
     $sql = implode(' ', $sqls);
     $statementContainer->setSql($sql);
     return;
 }
开发者ID:AlexandrKozyr,项目名称:ver_site,代码行数:29,代码来源:Select.php

示例11: resolvePlatform

 /**
  * @param null|PlatformInterface|AdapterInterface $adapterOrPlatform
  *
  * @return PlatformInterface
  *
  * @throws Exception\InvalidArgumentException
  */
 protected function resolvePlatform($adapterOrPlatform)
 {
     if (!$adapterOrPlatform) {
         return $this->getDefaultPlatform();
     }
     if ($adapterOrPlatform instanceof AdapterInterface) {
         return $adapterOrPlatform->getPlatform();
     }
     if ($adapterOrPlatform instanceof PlatformInterface) {
         return $adapterOrPlatform;
     }
     throw new Exception\InvalidArgumentException(sprintf('$adapterOrPlatform should be null, %s, or %s', 'Zend\\Db\\Adapter\\AdapterInterface', 'Zend\\Db\\Adapter\\Platform\\PlatformInterface'));
 }
开发者ID:karnurik,项目名称:zf2-turtorial,代码行数:20,代码来源:Platform.php

示例12: prepareStatement

 /**
  * @param   AdapterInterface            $adapter
  * @param   StatementContainerInterface $statementContainer
  * @return  void
  */
 public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer)
 {
     $driver = $adapter->getDriver();
     $platform = $adapter->getPlatform();
     $parameterContainer = $statementContainer->getParameterContainer();
     if (!$parameterContainer instanceof ParameterContainer) {
         $parameterContainer = new ParameterContainer();
         $statementContainer->setParameterContainer($parameterContainer);
     }
     $function = $platform->quoteIdentifierChain($this->function);
     $resultKey = $platform->quoteIdentifier($this->resultKey);
     $arguments = array();
     $i = 0;
     foreach ($this->arguments as $argument) {
         if ($argument instanceof Expression) {
             $exprData = $this->processExpression($argument, $platform, $driver);
             $arguments[] = $exprData->getSql();
             $parameterContainer->merge($exprData->getParameterContainer());
         } else {
             $parameterName = 'func_arg_' . $i++;
             $arguments[] = $driver->formatParameterName($parameterName);
             $parameterContainer->offsetSet($parameterName, $argument);
         }
     }
     $sql = sprintf($this->specifications[$this->mode], $function, implode(', ', $arguments), $resultKey);
     $statementContainer->setSql($sql);
 }
开发者ID:gridguyz,项目名称:zork,代码行数:32,代码来源:FunctionCall.php

示例13: __invoke

 public function __invoke($value = null)
 {
     return 'Platform name ' . $this->dbAdapter->getPlatform()->getName();
 }
开发者ID:avz-cmf,项目名称:zaboy-async,代码行数:4,代码来源:CallableWithDb.php

示例14: prepareStatement

 /**
  * Prepare statement
  *
  * @param AdapterInterface $adapter
  * @param StatementContainerInterface $statementContainer
  * @return void
  */
 public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer)
 {
     // ensure statement has a ParameterContainer
     $parameterContainer = $statementContainer->getParameterContainer();
     if (!$parameterContainer instanceof ParameterContainer) {
         $parameterContainer = new ParameterContainer();
         $statementContainer->setParameterContainer($parameterContainer);
     }
     $sqls = array();
     $sqls[self::SHOW] = sprintf($this->specifications[static::SHOW], $this->show);
     $likePart = $this->processLike($adapter->getPlatform(), $adapter->getDriver(), $parameterContainer);
     if (is_array($likePart)) {
         $sqls[self::LIKE] = $this->createSqlFromSpecificationAndParameters($this->specifications[static::LIKE], $likePart);
     }
     $sql = implode(' ', $sqls);
     $statementContainer->setSql($sql);
     return;
 }
开发者ID:joacub,项目名称:sphinxsearch,代码行数:25,代码来源:Show.php

示例15: prepareStatement

 /**
  * Prepare statement
  *
  * @param  AdapterInterface $adapter
  * @param  StatementContainerInterface $statementContainer
  * @return void
  */
 public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer)
 {
     $driver = $adapter->getDriver();
     $platform = $adapter->getPlatform();
     $parameterContainer = $statementContainer->getParameterContainer();
     if (!$parameterContainer instanceof ParameterContainer) {
         $parameterContainer = new ParameterContainer();
         $statementContainer->setParameterContainer($parameterContainer);
     }
     $table = $this->table;
     $table = $platform->quoteIdentifier($table);
     $set = $this->set;
     $setSql = array();
     foreach ($set as $column => $value) {
         if ($value instanceof Predicate\Expression) {
             $exprData = $this->processExpression($value, $platform, $driver);
             $setSql[] = $platform->quoteIdentifier($column) . ' = ' . $exprData->getSql();
             $parameterContainer->merge($exprData->getParameterContainer());
         } else {
             $setSql[] = $platform->quoteIdentifier($column) . ' = ' . $driver->formatParameterName($column);
             $parameterContainer->offsetSet($column, $value);
         }
     }
     $set = implode(', ', $setSql);
     $sql = sprintf($this->specifications[self::SPECIFICATION_UPDATE], $table, $set);
     // Process where
     if ($this->where->count() > 0) {
         $whereParts = $this->processExpression($this->where, $platform, $driver, 'where');
         $parameterContainer->merge($whereParts->getParameterContainer());
         $sql .= ' ' . sprintf($this->specifications[self::SPECIFICATION_WHERE], $whereParts->getSql());
     }
     // Process option
     $optionParts = $this->processOption($platform, $driver, $parameterContainer);
     if (is_array($optionParts)) {
         $sql .= ' ' . $this->createSqlFromSpecificationAndParameters($this->specifications[self::SPECIFICATION_OPTION], $optionParts);
     }
     $statementContainer->setSql($sql);
 }
开发者ID:joacub,项目名称:sphinxsearch,代码行数:45,代码来源:Update.php


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