Execute the prepared statement

@param  array $bound_input_params  [$key => $value]
@return self
541939
final public function execute($bound_input_params = null)
	{
		if (!is_array($bound_input_params) or empty($bound_input_params)) {
			$success = parent::execute();
		} else {
			$success = parent::execute($this->bindConversion($bound_input_params));
		}

		// Accumulative success of statement execution
		if (is_null($this->_success)) {
			// Success is not set, so it is the result of this execution
			$this->_success = $success;
		} else {
			// Success is already set, so it is `&=`d to `$success`
			// false &= true -> false
			// true &= false -> false
			// true &= true -> true
			$this->_success &= $this->_success;
		}
		return $this;
	}
846837
public int bindValues(PreparedStatement stmt, ValueContainer[] values, int index) throws SQLException
    {
        if (values != null)
        {
            for (int i = 0; i < values.length; i++)
            {
                setObjectForStatement(stmt, index, values[i].getValue(), values[i].getJdbcType().getType());
                index++;
            }
        }
        return index;
    }
712566
public function bindValue(\PDOStatement $stmt, $parameter, $value, ColumnMap $cMap, $position = null)
    {
        $pdoType = $cMap->getPdoType();
        // FIXME - This is a temporary hack to get around apparent bugs w/ PDO+MYSQL
        // See http://pecl.php.net/bugs/bug.php?id=9919
        if (\PDO::PARAM_BOOL === $pdoType) {
            $value = (int) $value;
            $pdoType = \PDO::PARAM_INT;

            return $stmt->bindValue($parameter, $value, $pdoType);
        }

        if ($cMap->isTemporal()) {
            $value = $this->formatTemporalValue($value, $cMap);
        } elseif (is_resource($value) && $cMap->isLob()) {
            // we always need to make sure that the stream is rewound, otherwise nothing will
            // get written to database.
            rewind($value);
        }

        return $stmt->bindValue($parameter, $value, $pdoType);
    }
1365736
public function bind($key, $value = null)
    {
        if (is_array($key))
        {
            foreach ($key as $name => $value)
            {
                $this->_bound[$name] = $value;
            }
        }
        else
        {
            $this->_bound[$key] = $value;
        }

        return $this;
    }
842128
public function execute()
    {
        try {
            $sql = $this->prepared_sql;

            foreach ($this->param_list as $placeholder => $param) {
                if (strpos($this->prepared_sql, $placeholder) === false) {
                    throw new DatabaseException(__METHOD__ . " missing bound placeholder: $placeholder in sql $this->prepared_sql", MySQL::ERR_CONN, MySQL::SEVERITY_LOG, __FILE__, __LINE__);
                }


                $t = (isset($this->type_list[$placeholder]) ? $this->type_list[$placeholder] : 999999);

                switch ($t) {
                    case self::TYPE_BLOB:
                    case self::TYPE_STRING:
                        $val = "'" . mysql_real_escape_string($param, $this->_db->db) . "'";
                        break;
                    case self::TYPE_INT:
                    case self::TYPE_BOOL:
                        $val = (int)$param;
                        break;
                    case self::TYPE_FLOAT:
                        $val = (float)$param;
                        break;
                    case self::TYPE_NULL:
                        $val = 'NULL';
                        break;
                    default:
                        $val = "'" . (mysql_real_escape_string($param, $this->_db->db)) . "'";
                        break;
                }
                $sql = str_replace($placeholder, $val, $sql);
            }
        } catch (DatabaseException $e) {
            throw $e;
        }

        unset($t, $val, $param);

        /**
         * set the sql for debugging purposes
         */
        $this->sql = $sql;

        /**
         * query the database
         */
        $this->res = $this->_db->query($sql);

        if (!$this->res) return false;

        return $this;
    }
548897
public function prepare($query, array $bindings=[])
    {
        $statement = $this->statement($query);

        $this->callBeforeListeners('prepare',[$query, $bindings]);

        $prepared = (new PDOPrepared(
            $statement,
            $query,
            $this->getOption(self::RETURN_LAST_AFFECTED),
            $this->errorHandler
        ))->bind($bindings);

        $this->callAfterListeners('prepare',[$query, $bindings, $prepared]);

        return $prepared;

    }
1359238
public function prepareAndExecuteSql($sql, $binds = [])
    {
        $prepare = $this->prepareSQL($sql, $binds);

        return $this->executePrepared($prepare);
    }
1080740
public function bind($sql, array $params=array())
    {
        return $this->_bindInto('\?', $sql, $params, function($binder, $param) use ($sql) {
            return $binder->sqlValue($param);
        });
    }
414132
public function execute($values=null)
    {
        $ok = false;
        set_error_handler(array($this->_pdooci,"errorHandler"));
        try {
            $auto = $this->_pdooci->getAutoCommit() ? \OCI_COMMIT_ON_SUCCESS : \OCI_NO_AUTO_COMMIT;

            if ($values && sizeof($values)>0) {
                foreach ($values as $key => $val) {
                    $parm = $key;
                    if (preg_match('/^\d+$/', $key)) {
                        $parm ++;
                    }
                    $this->bindParam($parm, $values[$key]);
                    $this->_pdooci->setError();
                }
            }
            $ok = \oci_execute($this->_stmt, $auto);
            if (!$ok) {
                $this->_pdooci->setError($this->_stmt);
                $error = $this->_pdooci->errorInfo();
                throw new \PDOException($error[2]);
            } else {
                if (count($this->_bindsLob)) {
                    foreach ($this->_bindsLob as $param => $bind) {
                        $ok = $bind['lob']->save($bind['value']);
                        if (!$ok) {
                            $error = $this->_pdooci->errorInfo();
                            $e = new \PDOException($error[2], $error[1]);
                            $e->errorInfo = $error;
                            throw $e;
                        }
                    }
                }
            }
        } catch (\PDOException $e) {
            throw $e;
        } catch (\Exception $e) {
            throw new \PDOException($e->getMessage());
        }
        restore_error_handler();
        return $ok;
    }
124725
private function executeParallel($stmt, array $values = null): PromiseInterface
    {
        if (is_string($stmt)) {
            $stmt = $this->emulatePrepare((string) $stmt, $values);
        } else {
            if (!$stmt instanceof Statement) {
                throw new \InvalidArgumentException(sprintf('Expected %s object, got %s', Statement::class, get_class($stmt)));
            }
            if (!$stmt instanceof EmulatedStatement) {
                $stmt = $this->emulatePrepare((string) $stmt, $values ?? $stmt->getValues());
            } elseif (null !== $values) {
                $stmt = $stmt->withValues($values);
            }
        }
        try {
            // Clone connection (Mysqli Asynchronous queries require a different connection to work properly)
            $credentials = $this->getCredentials();
            $cnx         = self::createLink($credentials);
            if ($this->hasOption('charset')) {
                $cnx->set_charset($this->getOption('charset'));
            }
        } catch (mysqli_sql_exception $e) {
            throw new AccessDeniedException($e->getMessage(), (int) $e->getCode(), $e);
        }

        $stmt->bind();
        $promise = MysqliAsync::query($stmt->getRunnableQuery(), $cnx)->then(function ($result) use ($cnx, $stmt) {
            if (!$result instanceof mysqli_result) {
                $result = null;
            }
            return new Result($cnx, $result);
        });

        return $promise;
    }
57320
public function bind(PDOStatement $pdo_statement, array $data = [])
    {
        foreach ($data as $key => $value) {
            if (is_null($value) || strtolower($value) === 'null') {
                $pdo_statement->bindValue(
                    ':' . $key,
                    $value,
                    PDO::PARAM_NULL
                );
                
                unset($data[$key]);
            }
        }

        foreach ($data as $key => $value) {
            $param = PDO::PARAM_INT;

            if (preg_match('/[a-z0-9A-Z_-]+|éàèëïùöôîüµ$£!?\.\+,;:/', $value) && !is_numeric($value)) {
                /**
                 * SECURITY OF DATA
                 * - Injection SQL
                 * - XSS
                 */
                $param = PDO::PARAM_STR;
            } else {
                /**
                 * We force the value in whole or in reel.
                 */
                if (is_int($value)) {
                    $value = (int) $value;
                } elseif (is_float($value)) {
                    $value = (float) $value;
                } else {
                    $value = (double) $value;
                }
            }

            if (is_string($key)) {
                $pdo_statement->bindValue(':' . $key, $value, $param);
            } else {
                $pdo_statement->bindValue($key + 1, $value, $param);
            }
        }

        return $pdo_statement;
    }
1317208
static function executeInputHandlers( &$module, &$class, $object, &$version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage )
    {
        $http = eZHTTPTool::instance();
        $functionName = 'fetchInput';
        $params = array( $http,
                         &$module,
                         &$class,
                         $object,
                         &$version,
                         $contentObjectAttributes,
                         $editVersion,
                         $editLanguage,
                         $fromLanguage );

       self::executeHandlerFunction( $functionName, $params );
    }
356196
public function bindExecute($query, $parameters = [])
    {
        $statement = $this->link->prepare($query);

        foreach ($parameters as $index => $paramProperties) {
            if (is_object($paramProperties)) {
                $paramProperties = (array) $paramProperties;
            }
            if (is_array($paramProperties)) {
                $statement->bindValue(
                    (int) $index + 1,
                    $paramProperties['value'],
                    $paramProperties['param']
                );
            } else {
                $statement->bindValue((int) $index + 1, $paramProperties);
            }
        }

        $statement->execute();

        return $statement->rowCount();
    }
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;
    }
188349
protected function bindValues($values) {
        if(is_array($values)) {
            foreach($values as $i => $value) {
                if(is_numeric($value) && intval($value) == $value && $value[0] != 0) {$type = PDO::PARAM_INT; $value = intval($value);}
                elseif(is_null($value) || $value === 'NULL') {$type = PDO::PARAM_NULL; $value = NULL;}
                elseif(is_bool($value)) {$type = PDO::PARAM_BOOL;}
                else{$type = PDO::PARAM_STR;}
                $this->query->bindValue(intval($i + 1), $value, $type);
            }
        }
    }
25806
private function bindFields()
    {
        foreach ($this->fields as $key => $value) {
            $this->statement->bindValue(':' . $key, $value);
        }
    }
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;
	}