當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DboSource::_execute方法代碼示例

本文整理匯總了PHP中DboSource::_execute方法的典型用法代碼示例。如果您正苦於以下問題:PHP DboSource::_execute方法的具體用法?PHP DboSource::_execute怎麽用?PHP DboSource::_execute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DboSource的用法示例。


在下文中一共展示了DboSource::_execute方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _execute

 /**
  * Executes given SQL statement.
  *
  * @param string $sql SQL statement
  * @param array $params list of params to be bound to query (supported only in select)
  * @param array $prepareOptions Options to be used in the prepare statement
  * @return mixed PDOStatement if query executes with no problem, true as the result of a succesfull, false on error
  * query returning no rows, suchs as a CREATE statement, false otherwise
  */
 protected function _execute($sql, $params = array(), $prepareOptions = array())
 {
     $this->_lastAffected = false;
     if (strncasecmp($sql, 'SELECT', 6) == 0) {
         $prepareOptions += array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL);
         return parent::_execute($sql, $params, $prepareOptions);
     }
     try {
         $this->_lastAffected = $this->_connection->exec($sql);
         if ($this->_lastAffected === false) {
             $this->_results = null;
             $error = $this->_connection->errorInfo();
             $this->error = $error[2];
             return false;
         }
         return true;
     } catch (PDOException $e) {
         if (isset($query->queryString)) {
             $e->queryString = $query->queryString;
         } else {
             $e->queryString = $sql;
         }
         throw $e;
     }
 }
開發者ID:kevguy,項目名稱:Auth-Website,代碼行數:34,代碼來源:Sqlserver.php

示例2: _execute

 /**
  * Executes given SQL statement.
  *
  * @param string $sql SQL statement
  * @param array $params list of params to be bound to query (supported only in select)
  * @param array $prepareOptions Options to be used in the prepare statement
  * @return mixed PDOStatement if query executes with no problem, true as the result of a successful, false on error
  * query returning no rows, such as a CREATE statement, false otherwise
  * @throws PDOException
  */
 protected function _execute($sql, $params = array(), $prepareOptions = array())
 {
     $this->_lastAffected = false;
     if (strncasecmp($sql, 'SELECT', 6) === 0 || preg_match('/^EXEC(?:UTE)?\\s/mi', $sql) > 0) {
         return parent::_execute($sql, $params);
     }
     try {
         $this->_lastAffected = $this->_connection->exec($sql);
         if ($this->_lastAffected === false) {
             $this->_results = null;
             $error = $this->_connection->errorInfo();
             $this->error = $error[2];
             return false;
         }
         return true;
     } catch (PDOException $e) {
         if (isset($query->queryString)) {
             $e->queryString = $query->queryString;
         } else {
             $e->queryString = $sql;
         }
         throw $e;
     }
 }
開發者ID:alphp,項目名稱:cakephp-2.x_oracle-driver,代碼行數:34,代碼來源:Oracle.php

示例3: _execute

 /**
  * Executes given SQL statement.
  *
  * @param string $sql            SQL statement
  * @param array  $params         list of params to be bound to query (supported only in select)
  * @param array  $prepareOptions Options to be used in the prepare statement
  *
  * @return mixed PDOStatement if query executes with no problem, true as the result of a successful, false on error
  * query returning no rows, such as a CREATE statement, false otherwise
  * @throws PDOException
  */
 protected function _execute($sql, $params = array(), $prepareOptions = array())
 {
     $this->_lastAffected = FALSE;
     $sql = trim($sql);
     if (strncasecmp($sql, 'SELECT', 6) === 0 || preg_match('/^EXEC(?:UTE)?\\s/mi', $sql) > 0) {
         $prepareOptions += array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL);
         return parent::_execute($sql, $params, $prepareOptions);
     }
     try {
         $this->_lastAffected = $this->_connection->exec($sql);
         if ($this->_lastAffected === FALSE) {
             $this->_results = NULL;
             $error = $this->_connection->errorInfo();
             $this->error = $error[2];
             return FALSE;
         }
         return TRUE;
     } catch (PDOException $e) {
         if (isset($query->queryString)) {
             $e->queryString = $query->queryString;
         } else {
             $e->queryString = $sql;
         }
         throw $e;
     }
 }
開發者ID:mrbadao,項目名稱:api-official,代碼行數:37,代碼來源:Sqlserver.php


注:本文中的DboSource::_execute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。