Prepare the query bindings for execution.

@param  array  $bindings
@return array
323416
public function prepareBindings(array $bindings)
    {
        $grammar = $this->getQueryGrammar();

        $prepared = array();

        foreach ($bindings as $key => $binding)
        {
            // The bindings are collected in a little bit different way than
            // Eloquent, we will need the key name in order to know where to replace
            // the value using the Neo4j client.
            $value = $binding;

            // We need to get the array value of the binding
            // if it were mapped
            if (is_array($value))
            {
                // There are different ways to handle multiple
                // bindings vs. single bindings as values.
                $value = array_values($value);
            }

            // We need to transform all instances of the DateTime class into an actual
            // date string. Each query grammar maintains its own date string format
            // so we'll just ask the grammar for the format to get from the date.

            if ($value instanceof DateTime)
            {
                $binding = $value->format($grammar->getDateFormat());
            }

            $property = is_array($binding) ? key($binding) : $key;

            // We will set the binding key and value, then
            // we replace the binding property of the id (if found)
            // with a _nodeId instead since the client
            // will not accept replacing "id(n)" with a value
            // which have been previously processed by the grammar
            // to be _nodeId instead.
            if ( ! is_array($binding))
            {
                $binding = [$binding];
            }

            foreach ($binding as $property => $real)
            {
                // We should not pass any numeric key-value items since the Neo4j client expects
                // a JSON map parameters.
                if (is_numeric($property))
                {
                    $property = (! is_numeric($key)) ? $key : 'id';
                }

                if ($property == 'id') $property = $grammar->getIdReplacement($property);

                $prepared[$property] = $real;
            }
        }

        return $prepared;
    }
215356
public function statement($query, $bindings = [])
    {
        return $this->run($query, $bindings, function ($query, $bindings) {
            if ($this->pretending()) {
                return true;
            }

            $statement = $this->getPdo()->prepare($query);

            $this->bindValues($statement, $this->prepareBindings($bindings));

            return $statement->execute();
        });
    }
408585
public function bind_and_run( $query, $bindings = [] )
	{
		$new_query = $this->bind_params( $query, $bindings );

		$result = $this->db->query( $new_query );

		if ( $result === false || $this->db->last_error ) {
			throw new QueryException( $new_query, $bindings, new \Exception( $this->db->last_error ) );
		}

		return (array) $result;
	}
83473
private function prepareQuery($params = []) {
		if(!is_array($params)) {
			return $params;
		}

		$query = [];

		foreach($params as $key => $value) {
			if(is_array($value)) {
				foreach($value as $element) {
					$query[] = sprintf(
						'%s[]=%s',
						$key,
						urlencode($element)
					);
				}
			} else {
				$query[] = sprintf(
					'%s=%s',
					$key,
					urlencode($value)
				);
			}
		}

		return implode("&",$query);
	}
660454
public function setBindings(array $bindings)
    {
        foreach ($bindings as $key => $binding) {
            if (0 < strpos($key, '$') && $key !== $k = preg_replace('/[ \t]*\$/', ' $', $key)) {
                unset($bindings[$key]);
                $bindings[$key = $k] = $binding;
            }
            if (!$binding instanceof BoundArgument) {
                $bindings[$key] = new BoundArgument($binding);
            }
        }

        $this->bindings = $bindings;

        return $this;
    }
812458
public function setBindings(array $bindings)
    {
        foreach ($bindings as $key => $binding) {
            if (!$binding instanceof BoundArgument) {
                $bindings[$key] = new BoundArgument($binding);
            }
        }

        $this->bindings = $bindings;

        return $this;
    }
954997
public function execute($query, $bindings = [])
    {
        if (strtolower(substr($query, 0, 6)) === "select" && $this->forcePrefix) {
            $query = $this->forcePrefix . $query;
        }

        return $this->run($query, $bindings, function ($query, $bindings) {
            if ($this->pretending()) {
                return true;
            }

            $statement = $this->getPdo()->prepare($query);

            $this->bindValues($statement, $bindings);

            $statement->execute();
            return $statement;
        });
    }
1122602
public function query(string $sql, array $bindings = []): IQueryBuilderHandler
    {
        $queryObject = new QueryObject($sql, $bindings, $this->getConnection());
        $this->connection->setLastQuery($queryObject);

        $this->fireEvents(EventHandler::EVENT_BEFORE_QUERY, $queryObject);

        [$response, $executionTime] = $this->statement($queryObject->getSql(), $queryObject->getBindings());

        $this->fireEvents(EventHandler::EVENT_AFTER_QUERY, $queryObject, [
            'execution_time' => $executionTime,
        ]);

        $this->pdoStatement = $response;

        return $this;
    }
341702
protected static function prepareBinding(array $replacements = [], $prefix = '{', $suffix = '}')
    {
        $replacements = Arr::dot($replacements);
        $bindings     = [];

        foreach ($replacements as $key => $value) {
            $bindings["{$prefix}{$key}{$suffix}"] = $value;
        }

        return $bindings;
    }
1147026
protected function retrieve( $method, $query, array $bindings = [] ) {
		return $this->run( $query, $bindings, function ( $query, $bindings ) use ( $method ) {
			if ( $this->pretending() ) {
				return [];
			}

			return $this->wpdb->{$method}(
				$this->prepareQuery( $query, $bindings ), $this->outputMode // @codingStandardsIgnoreLine
			);
		} );
	}
455064
public function bindValues($statement, $bindings)
    {
        foreach ($bindings as $key => $value) {
            $statement->bindValue(
                is_string($key) ? $key : $key + 1, $value,
                is_int($value) ? PDO::PARAM_INT : PDO::PARAM_STR
            );
        }
    }
751276
private function prepare($args)
    {
        $bindings = array();

        // Two parameters (key, value).
        if (count($args) == 2) {
            $bindings[$args[0]] = $args[1];
        }
        // Array of parameters.
        elseif (is_array($args[0])) {
            $bindings = $args[0];
        }

        return $bindings;
    }
97065
public function statement( $query, $bindings = [] )
	{
		$new_query = $this->bind_params( $query, $bindings, true );

		return $this->unprepared( $new_query );
	}
933278
public function values(array $bindings) {
        $references = array();
        foreach ($bindings as $k => $v) {
            $references[] = ":$k";
        }

        $this->sql .= 'VALUES (' . implode(', ', $references) . ') ';
        $this->params = array_merge($this->params, array_combine($references, array_values($bindings)));
        return $this;
    }
105210
public function query(string $query, array $bindings = null): Query
    {
        $this->lastQuery = new Query($query, $bindings, $this->configKey);
        return $this->lastQuery;
    }
1098861
public function prepareBindingsForUpdate(array $bindings, array $values)
    {
        $bindingsWithoutJoin = $bindings;
        unset($bindingsWithoutJoin['join']);

        return array_values(
            array_merge($bindings['join'], $values, array_flatten($bindingsWithoutJoin))
        );
    }
763492
public function bind($bindings, $type = [])
	{
		$idx = 1;

		$this->bindings = $bindings;

		foreach ($bindings as $binding)
		{
			// We use bindValue here because that allows us to pass in plain old strings
			$this->statement->bindValue(
				$idx,
				$binding,
				isset($type[$idx]) ? $this->translateType($type[$idx]) : $this->inferType($binding)
			);

			$idx++;
		}

		return $this;
	}