當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。