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


PHP PDOStatement::execute方法代码示例

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


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

示例1: rewind

 function rewind()
 {
     $this->PDOStatement = $this->pdo->prepare($this->sql . ' ' . $this->ordersql . ' ' . $this->limitsql);
     $this->PDOStatement->execute($this->params);
     $this->PDOStatement->setFetchMode(PDO::FETCH_ASSOC);
     $this->position = 0;
 }
开发者ID:boofw,项目名称:phpole,代码行数:7,代码来源:Cursor.php

示例2: init

 public function init()
 {
     $selectQuery = $this->dbHandler->createSelectQuery();
     $selectQuery->select('filepath')->from($this->dbHandler->quoteTable('ezimagefile'));
     $this->statement = $selectQuery->prepare();
     $this->statement->execute();
 }
开发者ID:blankse,项目名称:ezpublish-kernel-1,代码行数:7,代码来源:LegacyStorageImageFileRowReader.php

示例3: execute

 /**
  * @param array|null $parameters
  * @param bool|null  $disableQueryBuffering
  * @throws CM_Db_Exception
  * @return CM_Db_Result
  */
 public function execute(array $parameters = null, $disableQueryBuffering = null)
 {
     $disableQueryBuffering = (bool) $disableQueryBuffering;
     $retryCount = 1;
     for ($try = 0; true; $try++) {
         try {
             if ($disableQueryBuffering) {
                 $this->_client->setBuffered(false);
             }
             @$this->_pdoStatement->execute($parameters);
             if ($disableQueryBuffering) {
                 $this->_client->setBuffered(true);
             }
             CM_Service_Manager::getInstance()->getDebug()->incStats('mysql', $this->getQueryString());
             return new CM_Db_Result($this->_pdoStatement);
         } catch (PDOException $e) {
             if ($try < $retryCount && $this->_client->isConnectionLossError($e)) {
                 $this->_client->disconnect();
                 $this->_client->connect();
                 $this->_reCreatePdoStatement();
                 continue;
             }
             throw new CM_Db_Exception('Cannot execute SQL statement', null, ['tries' => $try, 'originalExceptionMessage' => $e->getMessage(), 'query' => $this->_pdoStatement->queryString]);
         }
     }
     throw new CM_Db_Exception('Line should never be reached');
 }
开发者ID:cargomedia,项目名称:cm,代码行数:33,代码来源:Statement.php

示例4: execute

 /**
  * @see \PDOStatement::execute
  */
 public function execute(array $input_parameters = array())
 {
     $start = microtime(true);
     $result = $this->statement->execute($input_parameters);
     $this->pdo->addLog(array('query' => $this->statement->queryString, 'time' => microtime(true) - $start, 'values' => array_merge($this->binds, $input_parameters)));
     return $result;
 }
开发者ID:so222es,项目名称:gesall,代码行数:10,代码来源:PdoStatement.php

示例5: __construct

 public function __construct(Connection $connection, $queryString, array $params)
 {
     $time = microtime(TRUE);
     $this->connection = $connection;
     $this->supplementalDriver = $connection->getSupplementalDriver();
     $this->queryString = $queryString;
     $this->params = $params;
     try {
         if (substr($queryString, 0, 2) === '::') {
             $connection->getPdo()->{substr($queryString, 2)}();
         } elseif ($queryString !== NULL) {
             static $types = ['boolean' => PDO::PARAM_BOOL, 'integer' => PDO::PARAM_INT, 'resource' => PDO::PARAM_LOB, 'NULL' => PDO::PARAM_NULL];
             $this->pdoStatement = $connection->getPdo()->prepare($queryString);
             foreach ($params as $key => $value) {
                 $type = gettype($value);
                 $this->pdoStatement->bindValue(is_int($key) ? $key + 1 : $key, $value, isset($types[$type]) ? $types[$type] : PDO::PARAM_STR);
             }
             $this->pdoStatement->setFetchMode(PDO::FETCH_ASSOC);
             $this->pdoStatement->execute();
         }
     } catch (\PDOException $e) {
         $e = $this->supplementalDriver->convertException($e);
         $e->queryString = $queryString;
         throw $e;
     }
     $this->time = microtime(TRUE) - $time;
 }
开发者ID:nette,项目名称:database,代码行数:27,代码来源:ResultSet.php

示例6: findAll

 /**
  * <b>Não é passado com os Joins</b>
  * 
  * @return array[Objetos]
  */
 public function findAll()
 {
     $sql = "SELECT * FROM {$this->Table}";
     $this->Stmt = Conn::prepare($sql);
     $this->Stmt->execute();
     return $this->Stmt->fetchAll();
 }
开发者ID:adrianosilvareis,项目名称:FrameWork_Front,代码行数:12,代码来源:Business.class.php

示例7: execute

 /**
  * @return bool
  *
  * @todo probably we can unset query an params to free up memory
  */
 protected function execute()
 {
     $this->statement = $this->dbh->prepare($this->query);
     // set fetchMode to assoc, it is easier to copy data from an array than an object
     $this->statement->setFetchMode(PDO::FETCH_ASSOC);
     return $this->statement->execute($this->params);
 }
开发者ID:rrelmy,项目名称:rorm,代码行数:12,代码来源:Query.php

示例8: execute

 /**
  * @see \Nanozen\Contracts\Providers\Database\DatabaseProviderContract::execute()
  * @return boolean
  */
 public function execute(array $parameters = [])
 {
     if (is_null($this->query)) {
         throw new \Exception('Cannot invoke execute. Try using query or prepare/execute before fetch.');
     }
     return $this->query->execute($parameters);
 }
开发者ID:brslv,项目名称:nanozen_cms,代码行数:11,代码来源:DatabaseProvider.php

示例9: get_row

 /**
  * @param PDOStatement $stm
  * @param array $data
  * @return array
  */
 protected function get_row(PDOStatement $stm, array $data = array())
 {
     $data ? $stm->execute($data) : $stm->execute();
     $stm->setFetchMode(PDO::FETCH_ASSOC);
     $var = $stm->fetch();
     return $var;
 }
开发者ID:novichkovv,项目名称:newddetox,代码行数:12,代码来源:model.php

示例10: _refresh

 /**
  * Reexecutes recordset query with the same parameters
  * This function is called inside @see rewind()
  *
  */
 protected function _refresh()
 {
     $this->_statement->execute($this->_params);
     if ($this->_statement->errorCode() !== '00000') {
         throw new DbException($this->_statement->errorInfo(), $this->_statement->queryString);
     }
     $this->_currentRowIndex = 0;
 }
开发者ID:neevan1e,项目名称:Done,代码行数:13,代码来源:db.recordset.class.php

示例11: execute

 /**
  * Executes a SQL statement
  *
  * @param string $sql
  * @param array  $parameters
  * @param \PDO   $connection
  * @param int    $fetchMode
  *
  * @return int The number of affected rows
  */
 public static function execute($sql, $parameters = null, $connection = null, $fetchMode = \PDO::FETCH_ASSOC)
 {
     static::$_statement = static::createStatement($sql, $connection, $fetchMode);
     if (empty($parameters)) {
         return static::$_statement->execute();
     }
     return static::$_statement->execute($parameters);
 }
开发者ID:rajeshpillai,项目名称:php-utils,代码行数:18,代码来源:Sql.php

示例12: writeProduct

 /**
  * @param \Generated\Shared\Transfer\ProductConcreteTransfer $productConcreteTransfer
  *
  * @return bool
  */
 public function writeProduct(ProductConcreteTransfer $productConcreteTransfer)
 {
     $this->productStatement->execute([':sku' => $productConcreteTransfer->getSku(), ':isActive' => (int) $productConcreteTransfer->getIsActive(), ':attributes' => json_encode($productConcreteTransfer->getAttributes()), ':productAbstractSku' => $productConcreteTransfer->getProductAbstractSku()]);
     foreach ($productConcreteTransfer->getLocalizedAttributes() as $localizedAttributes) {
         $this->attributesStatement->execute([':productSku' => $productConcreteTransfer->getSku(), ':name' => $localizedAttributes->getName(), ':attributes' => json_encode($localizedAttributes->getAttributes()), ':fkLocale' => $this->localeTransfer->getIdLocale()]);
     }
     return true;
 }
开发者ID:spryker,项目名称:Product,代码行数:13,代码来源:ProductConcreteWriter.php

示例13: execute

 /**
  * Execute the statement
  */
 public function execute()
 {
     $start = microtime(true);
     $result = $this->statement->execute();
     $time = microtime(true) - $start;
     DB::dbh()->log($this->postBindingStatement, round($time * 1000, 3));
     return $result;
 }
开发者ID:Acidburn0zzz,项目名称:xframe-legacy,代码行数:11,代码来源:LoggedPDOStatement.php

示例14: execute

 /**
  * {@inheritdoc}
  */
 public function execute($input_parameters = null)
 {
     $parameters = null === $input_parameters ? $this->binds : $input_parameters;
     $this->profiler->startQuery($this->statement->queryString, $parameters);
     $result = $this->statement->execute($input_parameters);
     $this->profiler->stopQuery();
     return $result;
 }
开发者ID:samleybrize,项目名称:bugzorcist,代码行数:11,代码来源:PDOProfilerStatement.php

示例15: execute

 public function execute($params = [])
 {
     if ($params) {
         $this->params = $params;
     }
     $this->stmt->execute($this->params);
     return $this;
 }
开发者ID:KonstantinKirchev,项目名称:WebDevelopment,代码行数:8,代码来源:DefaultDatabase.php


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