Executes a prepared statement.

@param array $params OPTIONAL Values to bind to parameter placeholders.
@return bool
@throws Zend_Db_Statement_Exception
162804
public function _execute(array $params = null)
    {
        try {
            if ($params !== null) {
                return $this->_stmt->execute($params);
            } else {
                return $this->_stmt->execute();
            }
        } catch (PDOException $e) {
            // require_once 'Zend/Db/Statement/Exception.php';
            throw new Zend_Db_Statement_Exception($e->getMessage(), (int) $e->getCode(), $e);
        }
    }
15961
public function exec($statement, $params = array())
    {
		
        if (count($params) > 0){
        	$sth = $this->dbConnector->prepare($statement);
        	$this->preparedExec = true;
        	$this->lastPreparedExecStatement = $sth;
        	$sth->execute($params);
        	$returnValue = $sth->rowCount();
        }
        else{
        	$this->preparedExec = false;
        	try {
        	    $returnValue = $this->dbConnector->exec($statement);
        	} catch (PDOException $e) {
        	    common_Logger::w('Error in statement: '.$statement);
        	    throw $e;
        	}
        }

        return (int) $returnValue;
    }
534479
public function execute($params = null) {
		if ($params === null) {
			$params = [];
		}

		try {
			$this->stmt->execute($params);

			return new QueryResult($this->stmt, $this->pdo);
		} catch (PDOException $e) {
			throw $this->exAdapter->adapt($e, $this->stmt, $params);
		}
	}
1171730
public function run($sql, array $params = array())
    {
        $sth = $this->pdo->prepare($sql);

        foreach ($params as $key => $value) {
            $key = is_numeric($key) ? $key + 1 : ":$key";
            $sth->bindValue($key, $value);
        }

        $sth->execute($params);
        $this->executed[] = $sql;
        return $sth;
    }
686562
public static function run($query, $params=array()) {
		
		$self = static::getInstance();
		
		$self->openConnection();
		
		$ret = NULL;
		
		try {
			
			// prepare query
			$stat = $self->handler->prepare($query);

			// bind parameters
			$stat->execute((array)$params);

			// count affected rows
			$affected = $stat->rowCount();
			
		} catch (\PDOException $e) {
			
			// logger
			$self->logParamQuery($query, 0, $params);
			
			switch ($e->getCode()) {
				
				// integrity constraint violation
				/*
				 case '23000':
					 $message = 'Database integrity constraint violation';
					 break;
				 */
				default:
					$message = $e->getMessage();
					break;
			}
			
			$self->addError($message);
			
			$affected = 0;
			
		} catch (\Exception $e) {
			
			// logger
			$self->logParamQuery($query, 0, $params);
			$self->addError($e->getMessage());
			$affected = 0;
			
		}
		
		$stat->closeCursor();
		$self->logParamQuery($query, $affected, $params);
		
		return $affected;
			
	}
1146087
public function update($params)
    {
        $query = $this->query->update($params);
        $this->db->exec($this->query->useQuery($params['db_name']));
        $prepare = $this->db->prepare($query);
        if ($prepare->execute()) {
            $prepare->closeCursor();

            return true;
        } else {
            return false;
        }
    }
1217191
public function run_query($sql, array $params=null, array $driverOptions=array()) {
		try {
			$this->sth = null;
			$this->sth = $this->dbh->prepare($sql, $driverOptions);
			if($this->sth === false) {
				throw new \Exception(__METHOD__ .": STH is false... ". ToolBox::debug_print($this->dbh->errorInfo(),0));
			}
			// TODO: throw an exception on error (and possibly if there were no rows returned)
			$this->sth->execute($params); 
			$this->numRows = $this->sth->rowCount();
		}
		catch(PDOException $px) {
			throw new \Exception(__METHOD__ .": ". $px->getMessage());
		}
		return($this->numRows);
	}
752986
public function execute(array $params = null)
    {
        $this->bindParams($params);
        $this->formatSqlByParams($params);
        $result = $this->stmt->execute();

        if ($result !== true) {
            throw new MysqlException('Sync mysql execute error，sql=' . $this->stmt->debugDumpParams());
        }
        $this->pushSqlToStack($this->sql);

        return $result;
    }
403818
public function execute($params)
    {
        $this->method = array_shift($params);
        $this->prepare($params);

        return $this->httpClient
            ->setMethod('post')
            ->setEndPoint(static::ENDPOINT.$this->method.'/')
            ->authHeaders()
            ->addHeader([ 'Content-Type' => 'application/json' ])
            ->setParams($this->params)
            ->send();
    }
1333799
public function query(string $query, array $params = []): bool
	{
		return $this->execute($this->prepare($query, $params));
	}
671890
public static int execute(Connection conn, String sql, Object... params) throws SQLException {
		PreparedStatement ps = null;
		try {
			ps = StatementUtil.prepareStatement(conn, sql, params);
			return ps.executeUpdate();
		} finally {
			DbUtil.close(ps);
		}
	}
594619
public function command(string $sql, array $params = [])
    {
        return $this->execute($this->prepare($sql, $params));
    }
1158740
protected function executeUpdate($sql,$bindparams=NULL) {
		$result = $this->db->handle->prepare($sql);
		$result->execute($bindparams);
		if ($result->errorCode() == '00000') {
			return true;
		} 
		$this->logStatementError($result->errorInfo(),$sql);
		return false;
	}
483457
public function rawExec(string $sql, array $params=[]): bool
  {
    $result = false;

    # Sanity check
    if (empty($sql)) {
      return $result;
    }

    # Obtain transaction, unelss already in a transaction
    $autoCommit = $this->beginTransaction();

    # Prepare
    if ($sth = $this->prepare($sql)) {
      # Binds
      foreach ($params as $bind=>$value) {
        $sth->bindValue( ':'.\ltrim($bind,':'), $value);
      }

      # Execute statement
      if ($sth->execute()) {
        $result = $sth->rowCount() > 0;
      }

      # Close cursor
      $sth->closeCursor();
    }

    # If we had a loacl transaction, commit it
    if ($autoCommit) $this->commit();

    return $result;
  }
537515
function execQueryString($sql, $params = null)
    {
        if (!is_array($params) && !is_null($params)) {
            $params = array($params);
        }

        $stmt = $this->prepare($sql);
        $stmt->execute($params);
        return $stmt;
    }
5576
public function execute($inputParams = [])
    {
        $bingID = $this->pdo->getBingId();
        $pool = $this->pdo->pool;
        if(!empty($inputParams)){
            $this->_boundColumns = $inputParams;
        }
        if(!empty($this->_boundColumns)){
            $this->prepareParamName();
            $this->_resultData = $pool->prepareAndExecute($this->statement,$this->_boundColumns,$bingID);
            $this->pdo->setLastInsertId($this->_resultData->insert_id);
        }else{
            $this->_resultData = $pool->doQuery($this->statement,$bingID);
        }
        if($this->_resultData->result === false){
            throw new PDOException($this->_resultData->error);
        }
        return true;
    }
771823
public function query($q, $params = array()){
		try{
			if(!empty($this->pdo)){
				$this->st = $this->pdo->prepare($q);
				if(!empty($params)){
					$keys = array_keys($params);
					$qmark = false;//qmark = question mark
					if(is_int($keys[0])){//mode '?'
						$qmark = true;
					}

					foreach($params as $p => $val){
						if($qmark){
							//$p is a numeric - 0, 1, 2, ...
							$p += 1;//bindValue starts to 1
						}
						if(is_array($val) && count($val) == 2){//if called with PDO::PARAM_STR or PDO::PARAM_INT, PDO::PARAM_BOOL
							$this->st->bindValue($p, $val[0], $val[1]);
						}
						else{
							if(! is_bool($val)) { //fix fatal error with some php versions
								$this->st->bindValue($p, $val);
							}
							else {
								$this->st->bindValue($p, $val, PDO::PARAM_INT);//cast
							}
						}
					}
				}

				$this->st->execute();
				return $this->st;
			}
			else{
				throw new DBException('PDO attribute is undefined');
			}
		}
		catch(\Exception $e){
			throw new DBException($e->getMessage(), $e->getCode());
		}
	}