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