function StatementWrapper::bindParam

Binds a parameter to the specified variable name.

Parameters

mixed $parameter: Parameter identifier. For a prepared statement using named placeholders, this will be a parameter name of the form :name.

mixed $variable: Name of the PHP variable to bind to the SQL statement parameter.

int $data_type: (Optional) explicit data type for the parameter using the PDO::PARAM_* constants. To return an INOUT parameter from a stored procedure, use the bitwise OR operator to set the PDO::PARAM_INPUT_OUTPUT bits for the data_type parameter.

int $length: (Optional) length of the data type. To indicate that a parameter is an OUT parameter from a stored procedure, you must explicitly set the length.

mixed $driver_options: (Optional) Driver options.

Return value

bool Returns TRUE on success or FALSE on failure.

Deprecated

in drupal:9.1.0 and is removed from drupal:10.0.0. StatementWrapper::bindParam should not be called. Access the client-level statement object via ::getClientStatement().

See also

https://www.drupal.org/node/3177488

File

core/lib/Drupal/Core/Database/StatementWrapper.php, line 389

Class

StatementWrapper
Implementation of StatementInterface encapsulating PDOStatement.

Namespace

Drupal\Core\Database

Code

public function bindParam($parameter, &$variable, int $data_type = \PDO::PARAM_STR, int $length = 0, $driver_options = NULL) : bool {
    @trigger_error("StatementWrapper::bindParam should not be called in drupal:9.1.0 and will error in drupal:10.0.0. Access the client-level statement object via ::getClientStatement(). See https://www.drupal.org/node/3177488", E_USER_DEPRECATED);
    switch (func_num_args()) {
        case 2:
            return $this->clientStatement
                ->bindParam($parameter, $variable);
        case 3:
            return $this->clientStatement
                ->bindParam($parameter, $variable, $data_type);
        case 4:
            return $this->clientStatement
                ->bindParam($parameter, $variable, $data_type, $length);
        case 5:
            return $this->clientStatement
                ->bindParam($parameter, $variable, $data_type, $length, $driver_options);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.