Consistent arguments of Statement::bindParam()

parent b31ad800
......@@ -103,31 +103,31 @@ class DB2Statement implements IteratorAggregate, Statement
/**
* {@inheritdoc}
*/
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null)
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null)
{
assert(is_int($column));
assert(is_int($param));
switch ($type) {
case ParameterType::INTEGER:
$this->bind($column, $variable, DB2_PARAM_IN, DB2_LONG);
$this->bind($param, $variable, DB2_PARAM_IN, DB2_LONG);
break;
case ParameterType::LARGE_OBJECT:
if (isset($this->lobs[$column])) {
[, $handle] = $this->lobs[$column];
if (isset($this->lobs[$param])) {
[, $handle] = $this->lobs[$param];
fclose($handle);
}
$handle = $this->createTemporaryFile();
$path = stream_get_meta_data($handle)['uri'];
$this->bind($column, $path, DB2_PARAM_FILE, DB2_BINARY);
$this->bind($param, $path, DB2_PARAM_FILE, DB2_BINARY);
$this->lobs[$column] = [&$variable, $handle];
$this->lobs[$param] = [&$variable, $handle];
break;
default:
$this->bind($column, $variable, DB2_PARAM_IN, DB2_CHAR);
$this->bind($param, $variable, DB2_PARAM_IN, DB2_CHAR);
break;
}
......
......@@ -101,16 +101,16 @@ class MysqliStatement implements IteratorAggregate, Statement
/**
* {@inheritdoc}
*/
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null)
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null)
{
assert(is_int($column));
assert(is_int($param));
if (! isset(self::$_paramTypeMap[$type])) {
throw new MysqliException(sprintf("Unknown type: '%s'", $type));
}
$this->_bindedValues[$column] =& $variable;
$this->types[$column - 1] = self::$_paramTypeMap[$type];
$this->_bindedValues[$param] =& $variable;
$this->types[$param - 1] = self::$_paramTypeMap[$type];
return true;
}
......
......@@ -14,7 +14,7 @@ class Statement extends PDOStatement
/**
* {@inheritdoc}
*/
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null)
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null)
{
if (
($type === ParameterType::LARGE_OBJECT || $type === ParameterType::BINARY)
......@@ -23,7 +23,7 @@ class Statement extends PDOStatement
$driverOptions = PDO::SQLSRV_ENCODING_BINARY;
}
return parent::bindParam($column, $variable, $type, $length, $driverOptions);
return parent::bindParam($param, $variable, $type, $length, $driverOptions);
}
/**
......
......@@ -87,7 +87,7 @@ class PDOStatement extends \PDOStatement implements Statement
}
/**
* @param mixed $column
* @param mixed $param
* @param mixed $variable
* @param int $type
* @param int|null $length
......@@ -95,12 +95,12 @@ class PDOStatement extends \PDOStatement implements Statement
*
* @return bool
*/
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null)
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null)
{
$type = $this->convertParamType($type);
try {
return parent::bindParam($column, $variable, $type, ...array_slice(func_get_args(), 3));
return parent::bindParam($param, $variable, $type, ...array_slice(func_get_args(), 3));
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
......
......@@ -92,9 +92,9 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
*
* @throws SQLAnywhereException
*/
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null)
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null)
{
assert(is_int($column));
assert(is_int($param));
switch ($type) {
case ParameterType::INTEGER:
......@@ -116,9 +116,9 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
throw new SQLAnywhereException('Unknown type: ' . $type);
}
$this->boundValues[$column] =& $variable;
$this->boundValues[$param] =& $variable;
if (! sasql_stmt_bind_param_ex($this->stmt, $column - 1, $variable, $type, $variable === null)) {
if (! sasql_stmt_bind_param_ex($this->stmt, $param - 1, $variable, $type, $variable === null)) {
throw SQLAnywhereException::fromSQLAnywhereError($this->conn, $this->stmt);
}
......
......@@ -167,14 +167,14 @@ class SQLSrvStatement implements IteratorAggregate, Statement
/**
* {@inheritdoc}
*/
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null)
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null)
{
if (! is_numeric($column)) {
if (! is_numeric($param)) {
throw new SQLSrvException('sqlsrv does not support named parameters to queries, use question mark (?) placeholders instead.');
}
$this->variables[$column] =& $variable;
$this->types[$column] = $type;
$this->variables[$param] =& $variable;
$this->types[$param] = $type;
// unset the statement resource if it exists as the new one will need to be bound to the new variable
$this->stmt = null;
......
......@@ -44,7 +44,7 @@ interface Statement extends ResultStatement
* of stored procedures that return data as output parameters, and some also as input/output
* parameters that both send in data and are updated to receive it.
*
* @param int|string $column Parameter identifier. For a prepared statement using named placeholders,
* @param int|string $param Parameter identifier. For a prepared statement using named placeholders,
* this will be a parameter name of the form :name. For a prepared statement using
* question mark placeholders, this will be the 1-indexed position of the parameter.
* @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter.
......@@ -56,7 +56,7 @@ interface Statement extends ResultStatement
*
* @return bool TRUE on success or FALSE on failure.
*/
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null);
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null);
/**
* Fetches the SQLSTATE associated with the last operation on the statement handle.
......
......@@ -47,11 +47,11 @@ class Statement implements IteratorAggregate, DriverStatement
/**
* {@inheritdoc}
*/
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null)
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null)
{
assert($this->stmt instanceof DriverStatement);
return $this->stmt->bindParam($column, $variable, $type, $length);
return $this->stmt->bindParam($param, $variable, $type, $length);
}
/**
......
......@@ -115,20 +115,20 @@ class Statement implements IteratorAggregate, DriverStatement
*
* Binding a parameter by reference does not support DBAL mapping types.
*
* @param string|int $name The name or position of the parameter.
* @param mixed $var The reference to the variable to bind.
* @param int $type The PDO binding type.
* @param int|null $length Must be specified when using an OUT bind
* so that PHP allocates enough memory to hold the returned value.
* @param string|int $param The name or position of the parameter.
* @param mixed $variable The reference to the variable to bind.
* @param int $type The PDO binding type.
* @param int|null $length Must be specified when using an OUT bind
* so that PHP allocates enough memory to hold the returned value.
*
* @return bool TRUE on success, FALSE on failure.
*/
public function bindParam($name, &$var, $type = ParameterType::STRING, $length = null)
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null)
{
$this->params[$name] = $var;
$this->types[$name] = $type;
$this->params[$param] = $variable;
$this->types[$param] = $type;
return $this->stmt->bindParam($name, $var, $type, $length);
return $this->stmt->bindParam($param, $variable, $type, $length);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment