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


PHP ParameterContainer::getPositionalArray方法代码示例

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


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

示例1: execute

 /**
  * Execute
  *
  * @param  ParameterContainer|null $parameters
  * @throws Exception\InvalidQueryException
  * @return Result
  */
 public function execute($parameters = null)
 {
     if (!$this->isPrepared()) {
         $this->prepare();
     }
     /** START Standard ParameterContainer Merging Block */
     if (!$this->parameterContainer instanceof ParameterContainer) {
         if ($parameters instanceof ParameterContainer) {
             $this->parameterContainer = $parameters;
             $parameters = null;
         } else {
             $this->parameterContainer = new ParameterContainer();
         }
     }
     if (is_array($parameters)) {
         $this->parameterContainer->setFromArray($parameters);
     }
     if ($this->parameterContainer->count() > 0) {
         $parameters = $this->parameterContainer->getPositionalArray();
     }
     /** END Standard ParameterContainer Merging Block */
     if ($this->profiler) {
         $this->profiler->profilerStart($this);
     }
     $resultResource = pg_execute($this->pgsql, $this->statementName, (array) $parameters);
     if ($this->profiler) {
         $this->profiler->profilerFinish();
     }
     if ($resultResource === false) {
         throw new Exception\InvalidQueryException(pg_last_error());
     }
     $result = $this->driver->createResult($resultResource);
     return $result;
 }
开发者ID:idwsdta,项目名称:INIT-frame,代码行数:41,代码来源:Statement.php

示例2: execute

 /**
  * Execute
  *
  * @param null $parameters
  * @return Result
  */
 public function execute($parameters = null)
 {
     if (!$this->isPrepared) {
         $this->prepare();
     }
     /** START Standard ParameterContainer Merging Block */
     if (!$this->parameterContainer instanceof ParameterContainer) {
         if ($parameters instanceof ParameterContainer) {
             $this->parameterContainer = $parameters;
             $parameters = null;
         } else {
             $this->parameterContainer = new ParameterContainer();
         }
     }
     if (is_array($parameters)) {
         $this->parameterContainer->setFromArray($parameters);
     }
     /** END Standard ParameterContainer Merging Block */
     if ($this->profiler) {
         $this->profiler->profilerStart($this);
     }
     set_error_handler(function () {
     }, E_WARNING);
     // suppress warnings
     $response = db2_execute($this->resource, $this->parameterContainer->getPositionalArray());
     restore_error_handler();
     if ($this->profiler) {
         $this->profiler->profilerFinish();
     }
     if ($response === false) {
         throw new Exception\RuntimeException(db2_stmt_errormsg($this->resource));
     }
     $result = $this->driver->createResult($this->resource);
     return $result;
 }
开发者ID:leonardovn86,项目名称:zf2_basic2013,代码行数:41,代码来源:Statement.php

示例3: bindParametersFromContainer

 /**
  * Bind parameters from container
  *
  */
 protected function bindParametersFromContainer()
 {
     $values = $this->parameterContainer->getPositionalArray();
     $position = 0;
     foreach ($values as $value) {
         $this->parameterReferences[$position++][0] = $value;
     }
 }
开发者ID:tillk,项目名称:vufind,代码行数:12,代码来源:Statement.php

示例4: testOffsetSet

 /**
  * @testdox unit test: Test offsetSet() works via method call and array access
  * @covers Zend\Db\Adapter\ParameterContainer::offsetSet
  */
 public function testOffsetSet()
 {
     $this->parameterContainer->offsetSet('boo', 'baz');
     $this->assertEquals('baz', $this->parameterContainer->offsetGet('boo'));
     $this->parameterContainer->offsetSet('1', 'book', ParameterContainer::TYPE_STRING);
     $this->assertEquals(array('foo' => 'bar', 'boo' => 'baz', '1' => 'book'), $this->parameterContainer->getNamedArray());
     $this->assertEquals('string', $this->parameterContainer->offsetGetErrata('1'));
     // test that setting an index applies to correct named parameter
     $this->parameterContainer[0] = 'Zero';
     $this->parameterContainer[1] = 'One';
     $this->assertEquals(array('foo' => 'Zero', 'boo' => 'One', '1' => 'book'), $this->parameterContainer->getNamedArray());
     $this->assertEquals(array(0 => 'Zero', 1 => 'One', 2 => 'book'), $this->parameterContainer->getPositionalArray());
     // test no-index applies
     $this->parameterContainer['buffer'] = 'A buffer Element';
     $this->parameterContainer[] = 'Second To Last';
     $this->parameterContainer[] = 'Last';
     $this->assertEquals(array('foo' => 'Zero', 'boo' => 'One', '1' => 'book', 'buffer' => 'A buffer Element', '4' => 'Second To Last', '5' => 'Last'), $this->parameterContainer->getNamedArray());
     $this->assertEquals(array(0 => 'Zero', 1 => 'One', 2 => 'book', 3 => 'A buffer Element', 4 => 'Second To Last', 5 => 'Last'), $this->parameterContainer->getPositionalArray());
 }
开发者ID:rajanlamic,项目名称:IntTest,代码行数:23,代码来源:ParameterContainerTest.php

示例5: execute

 /**
  * Execute
  *
  * @param null|array|ParameterContainer $parameters
  * @throws Exception\RuntimeException
  * @return mixed
  */
 public function execute($parameters = null)
 {
     if (!$this->isPrepared) {
         $this->prepare();
     }
     /** START Standard ParameterContainer Merging Block */
     if (!$this->parameterContainer instanceof ParameterContainer) {
         if ($parameters instanceof ParameterContainer) {
             $this->parameterContainer = $parameters;
             $parameters = null;
         } else {
             $this->parameterContainer = new ParameterContainer();
         }
     }
     if (is_array($parameters)) {
         $this->parameterContainer->setFromArray($parameters);
     }
     /** END Standard ParameterContainer Merging Block */
     if ($this->profiler) {
         $this->profiler->profilerStart($this);
     }
     $args = $this->parameterContainer->getPositionalArray();
     $argArray = [$this->resource];
     if (!empty($args)) {
         $argArray = array_merge($argArray, $args);
     }
     //die(var_dump($argArray));
     $response = call_user_func_array('ibase_execute', $argArray);
     if ($this->profiler) {
         $this->profiler->profilerFinish();
     }
     if ($response === false) {
         throw new Exception\RuntimeException(ibase_errmsg());
     }
     $result = $this->driver->createResult($response);
     return $result;
 }
开发者ID:srayner,项目名称:zend-db,代码行数:44,代码来源:Statement.php

示例6: bindParametersFromContainer

 /**
  * Bind parameters from container
  * 
  * @param ParameterContainer $pContainer
  */
 protected function bindParametersFromContainer(ParameterContainer $pContainer)
 {
     $parameters = $pContainer->getPositionalArray();
     $type = '';
     $args = array();
     foreach ($parameters as $position => &$value) {
         switch ($pContainer->offsetGetErrata($position)) {
             case ParameterContainer::TYPE_DOUBLE:
                 $type .= 'd';
                 break;
             case ParameterContainer::TYPE_NULL:
                 $value = null;
                 // as per @see http://www.php.net/manual/en/mysqli-stmt.bind-param.php#96148
             // as per @see http://www.php.net/manual/en/mysqli-stmt.bind-param.php#96148
             case ParameterContainer::TYPE_INTEGER:
                 $type .= 'i';
                 break;
             case ParameterContainer::TYPE_STRING:
             default:
                 $type .= 's';
                 break;
         }
         $args[] =& $value;
     }
     if ($args) {
         array_unshift($args, $type);
         call_user_func_array(array($this->resource, 'bind_param'), $args);
     }
 }
开发者ID:brikou,项目名称:zend_db,代码行数:34,代码来源:Statement.php


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