Executes a prepared statement

@param	array	$input_parameters - An array of values with as many elements as there are bound parameters in the SQL statement being executed. All values are treated as PDO::PARAM_STR.
@return	boolean
182885
public function execute(array $input_parameters = array())
	{
		$queryString = $this->queryString;
		
		if(count($input_parameters) > 0)
		{
			if(count($this->parameters) > 0 || count($this->parametersBound) > 0)
			{
				throw new LikePDOException("There is have parameters bound");
				return false;
			}
			else
			{
				foreach($input_parameters as $key => $param)
				{
					$value = is_int($param) ? intval($param) : $this->pdo->quote($param, LikePDO::PARAM_STR);
					
					if(is_int($key))
					{
						$position = strpos($queryString, "?");
						
						if(!strstr($queryString, "?"))
						{
							throw new LikePDOException("Statement: Too few parameters");
							return false;
						}
						
						$queryString = substr_replace($queryString, $value, $position, 1);
					}
					else
					{
						$queryString = str_replace($key, $value, $queryString);
					}
				}
			}
		}
		
		if(count($this->parametersBound) > 0)
		{
			foreach($this->parametersBound as $key => $param)
			{
				$value = $this->pdo->quote($param['variable'], $param['data_type']);
				
				if(is_int($key))
				{
					$position = strpos($queryString, "?");
					
					if(!strstr($queryString, "?"))
					{
						throw new LikePDOException("Statement: Too few parameters");
						return false;
					}
					
					$queryString = substr_replace($queryString, $value, $position, 1);
				}
				else
				{
					$queryString = str_replace($key, $value, $queryString);
				}
			}
		}
		
		if(count($this->parameters) > 0)
		{
			foreach($this->parameters as $key => $param)
			{
				$value = $this->pdo->quote($param['value'], $param['data_type']);
				
				if(is_int($key))
				{
					$position = strpos($queryString, "?");
					
					if(!strstr($queryString, "?"))
					{
						throw new LikePDOException("Statement: Too few parameters");
						return false;
					}
					
					$queryString = substr_replace($queryString, $value, $position, 1);
				}
				else
				{
					$queryString = str_replace($key, $value, $queryString);
				}
			}
		}
		
		$this->resource = $this->pdo->driver->query($queryString);
		$this->executed = true;
		$this->rowsAffected = $this->pdo->driver->getRowsAffected();
		$this->columnCount = $this->pdo->driver->getNumFields($this->resource);
		
		if(!$this->resource)
		{
			$this->failed = true;
			
			$this->errorCode = $this->pdo->errorCode();
			$this->errorInfo = $this->pdo->errorInfo();
			
			new LikePDOException("Failed to execute the query ".$this->queryString);
			
			return false;
		}
		
		return true;
	}
33459
public function bindParameters(mysqli_stmt $statement, array $parameters)
    {
        // Because mysqli_stmt::bind_param arguments must be passed by reference
        // we need to do a bit of hackery
        $boundNames = [];
        $parametersCount = count($parameters);
        for ($i = 0; $i < $parametersCount; $i++) {
            $boundName = "param$i";
            $$boundName = $parameters[$i];
            $boundNames[] = &$$boundName;
        }
        $statement->bind_param(...$boundNames);
    }
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;
    }
365705
public function execute($sql, array $parameters = array())
    {
        $this->logger->info($sql, array('parameters' => $parameters));

        try {
            $statement = $this->getPdo()->prepare($sql);
            $statement->execute($parameters);
        } catch (PDOException $exception) {
            $this->logger->error($exception->getMessage());

            throw $exception;
        }

        return $statement;
    }
915575
public function exec($sql = "", $bindingValues = array(), $insert = true)
    {
        //Check if the query is a SELECT|INSERT|UPDATE and :variation is available
        if (preg_match("/.*(SELECT|INSERT|UPDATE|SHOW|DELETE).*/", $sql)) {
            
            $this->sql = $sql;

            //Always prepare the SQL statement first
            $query = $this->connection->prepare($sql);

            if (preg_match('/\s*:(.+?)\s/', $sql)) {
                if (is_array($bindingValues) && !empty($bindingValues)) {
                    foreach ($bindingValues as $key => $val) {
                        //Clean the bindingValues. Check if they start with :
                        if (!preg_match('/:.*/', $key)) {
                            $bindingValues[":" . $key] = $val;
                            unset($bindingValues[$key]);
                        }
                    }
                }


                //Add the binding variables to the query
                if ($query->execute($bindingValues)) {
                    return $this->getLastInsertID();
                } else {
                    //@ToDo:When the save or update fails make sure we handle the error gracefully!
                    throw new \Exception(implode("\n", $query->errorInfo()));
                }

            } else {
                $result = $query->execute();
            }

            if (preg_match('/.*(SELECT|SHOW).*/', $sql)) {
                $query->setFetchMode(\PDO::FETCH_ASSOC);
                return $query->fetchAll();
            }

            return $result;
        }


        return false;
    }
248989
public function execute($sql, array $parameters = [])
    {
        $sth = $this->prepare($sql);
        $sth->execute($parameters);
        return $sth;
    }
668847
public function _execute(array $params = null)
    {
        if (!$this->_stmt) {
            return false;
        }

        $retval = true;
        if ($params !== null) {
            $retval = @db2_execute($this->_stmt, $params);
        } else {
            $retval = @db2_execute($this->_stmt);
        }

        if ($retval === false) {
            /**
             * @see Zend_Db_Statement_Db2_Exception
             */
            // require_once 'Zend/Db/Statement/Db2/Exception.php';
            throw new Zend_Db_Statement_Db2_Exception(
                db2_stmt_errormsg(),
                db2_stmt_error());
        }

        $this->_keys = array();
        if ($field_num = $this->columnCount()) {
            for ($i = 0; $i < $field_num; $i++) {
                $name = db2_field_name($this->_stmt, $i);
                $this->_keys[] = $name;
            }
        }

        $this->_values = array();
        if ($this->_keys) {
            $this->_values = array_fill(0, count($this->_keys), null);
        }

        return $retval;
    }
313236
function _query($sql,$inputarr=false)
	{
		if (is_array($inputarr)) {
			$i = 0;
			if (is_array($sql)) {
				foreach($inputarr as $v) {
					$arr['bind'.$i++] = $v;
				}
			} else {
				// Need to identify if the ? is inside a quoted string, and if
				// so not use it as a bind variable
				preg_match_all('/".*\??"|\'.*\?.*?\'/', $sql, $matches);
				foreach($matches[0] as $qmMatch){
					$qmReplace = str_replace('?', '-QUESTIONMARK-', $qmMatch);
					$sql = str_replace($qmMatch, $qmReplace, $sql);
				}

				// Replace parameters if any were found
				$sqlarr = explode('?',$sql);
				if(count($sqlarr) > 1) {
					$sql = $sqlarr[0];

					foreach ($inputarr as $k => $v) {
						$sql .= ":$k" . $sqlarr[++$i];
					}
				}

				$sql = str_replace('-QUESTIONMARK-', '?', $sql);
			}
		}
		return ADODB_oci8::_query($sql,$inputarr);
	}
37626
public function execute($input_parameters = null)
    {
        $return = $this->statement->execute($input_parameters);
        if ($this->connection->useDebug) {
            $sql = $this->getExecutedQueryString($input_parameters);
            $this->connection->log($sql);
            $this->connection->setLastExecutedQuery($sql);
            $this->connection->incrementQueryCount();
        }

        return $return;
    }
310201
private function execute($aSql, array $parameters)
    {
        $statement = $this->pdo->prepare($aSql);
        $statement->execute($parameters);

        return $statement;
    }
1342254
public function _execute(array $params = null)
    {
        $connection = $this->_adapter->getConnection();

        if (!$this->_stmt) {
            return false;
        }

        if ($params !== null) {
            if (!is_array($params)) {
                $params = array($params);
            }
            $error = false;
            foreach (array_keys($params) as $name) {
                if (!@oci_bind_by_name($this->_stmt, $name, $params[$name], -1)) {
                    $error = true;
                    break;
                }
            }
            if ($error) {
                /**
                 * @see Zend_Db_Adapter_Oracle_Exception
                 */
                // require_once 'Zend/Db/Statement/Oracle/Exception.php';
                throw new Zend_Db_Statement_Oracle_Exception(oci_error($this->_stmt));
            }
        }

        $retval = @oci_execute($this->_stmt, $this->_adapter->_getExecuteMode());
        if ($retval === false) {
            /**
             * @see Zend_Db_Adapter_Oracle_Exception
             */
            // require_once 'Zend/Db/Statement/Oracle/Exception.php';
            throw new Zend_Db_Statement_Oracle_Exception(oci_error($this->_stmt));
        }

        $this->_keys = Array();
        if ($field_num = oci_num_fields($this->_stmt)) {
            for ($i = 1; $i <= $field_num; $i++) {
                $name = oci_field_name($this->_stmt, $i);
                $this->_keys[] = $name;
            }
        }

        $this->_values = Array();
        if ($this->_keys) {
            $this->_values = array_fill(0, count($this->_keys), null);
        }

        return $retval;
    }
993326
public function create(array $input, array $queryParams = [])
    {
        $response = $this->client->post($this->uri(), [
            RequestOptions::JSON => ['application' => $input],
            'query' => $queryParams,
        ]);

        return $this->handleResponse($response);
    }
1126887
protected function bindParameters(
        \mysqli_stmt $stmt,
        array $parameters
    )/*# : bool */ {
        $types = '';
        $args = [];
        foreach ($parameters as $name => &$value) {
            $this->combineTypes($types, $value);
            $args[] = &$value;
        }
        if (count($args)) {
            array_unshift($args, $types);
            return call_user_func_array([$stmt, 'bind_param'], $args);
        }
        return true;
    }
1293222
public function execute(array $params = []) : array
    {
        foreach ($params as $paramName => $paramValue) {
            $type = is_int($paramValue) ? \PDO::PARAM_INT : \PDO::PARAM_STR;
            $this->getStatement()->bindValue($paramName, $paramValue, $type);
        }
        $this->getStatement()->execute();

        return $this->getStatement()->fetchAll(\PDO::FETCH_ASSOC);
    }
1373667
private function processParameters()
    {
        $parameters = $this->parameters;
        $string = $this->query;

        $string = str_replace('[:', '[;;', $string);

        $parameters = array_filter($parameters, function ($value) use (& $parameters, & $string)
        {
            $key = key($parameters);
            next($parameters);

            if (is_numeric($value))
            {
                $string = str_replace(":$key", $value, $string);
                return false;
            }

            else
            {
                $string = str_replace(":$key", '{' . $key . '}', $string);
                return true;
            }
        });

        $string = str_replace('[;;', '[:', $string);

        $this->query = $string;
        return $parameters;
    }
734758
protected function executeQuery($sql, array $parameters = [])
    {
        $this->connect();

        $dbParameters = $this->prepareParameters($parameters);
        try {
            $pdoStatement = $this->pdo->prepare($sql);
            $pdoStatement->execute($dbParameters);

            return $pdoStatement;
        } catch (PDOException $e) {
            throw new QueryException($e, $sql, $dbParameters);
        }
    }
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;
    }