8000 Clean up inconsistent or redundant argument names by morozov · Pull Request #4172 · doctrine/dbal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Clean up inconsistent or redundant argument names #4172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jul 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/Doctrine/DBAL/Cache/QueryCacheProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ public function getCacheKey()
/**
* Generates the real cache key from query, params, types and connection parameters.
*
* @param string $query
* @param string $sql
* @param mixed[] $params
* @param int[]|string[] $types
* @param mixed[] $connectionParams
*
* @return string[]
*/
public function generateCacheKeys($query, $params, $types, array $connectionParams = [])
public function generateCacheKeys($sql, $params, $types, array $connectionParams = [])
{
$realCacheKey = 'query=' . $query .
$realCacheKey = 'query=' . $sql .
'&params=' . serialize($params) .
'&types=' . serialize($types) .
'&connectionParams=' . hash('sha256', serialize($connectionParams));
Expand Down
134 changes: 67 additions & 67 deletions lib/Doctrine/DBAL/Connection.php

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ protected function chooseConnectionConfiguration($connectionName, $params)
/**
* {@inheritDoc}
*/
public function executeUpdate($query, array $params = [], array $types = [])
public function executeUpdate($sql, array $params = [], array $types = [])
{
$this->connect('master');

return parent::executeUpdate($query, $params, $types);
return parent::executeUpdate($sql, $params, $types);
}

/**
Expand Down Expand Up @@ -263,11 +263,11 @@ public function rollBack()
/**
* {@inheritDoc}
*/
public function delete($tableName, array $identifier, array $types = [])
public function delete($table, array $identifier, array $types = [])
{
$this->connect('master');

return parent::delete($tableName, $identifier, $types);
return parent::delete($table, $identifier, $types);
}

/**
Expand All @@ -286,31 +286,31 @@ public function close()
/**
* {@inheritDoc}
*/
public function update($tableName, array $data, array $identifier, array $types = [])
public function update($table, array $data, array $identifier, array $types = [])
{
$this->connect('master');

return parent::update($tableName, $data, $identifier, $types);
return parent::update($table, $data, $identifier, $types);
}

/**
* {@inheritDoc}
*/
public function insert($tableName, array $data, array $types = [])
public function insert($table, array $data, array $types = [])
{
$this->connect('master');

return parent::insert($tableName, $data, $types);
return parent::insert($table, $data, $types);
}

/**
* {@inheritDoc}
*/
public function exec($statement)
public function exec($sql)
{
$this->connect('master');

return parent::exec($statement);
return parent::exec($sql);
}

/**
Expand Down Expand Up @@ -372,10 +372,10 @@ public function query()
/**
* {@inheritDoc}
*/
public function prepare($statement)
public function prepare($sql)
{
$this->connect('master');

return parent::prepare($statement);
return parent::prepare($sql);
}
}
8 changes: 4 additions & 4 deletions lib/Doctrine/DBAL/Driver/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ interface Connection
/**
* Prepares a statement for execution and returns a Statement object.
*
* @param string $prepareString
* @param string $sql
*
* @return Statement
*/
public function prepare($prepareString);
public function prepare($sql);

/**
* Executes an SQL statement, returning a result set as a Statement object.
Expand All @@ -41,11 +41,11 @@ public function quote($input, $type = ParameterType::STRING);
/**
* Executes an SQL statement and return the number of affected rows.
*
* @param string $statement
* @param string $sql
*
* @return int
*/
public function exec($statement);
public function exec($sql);

/**
* Returns the ID of the last inserted row or sequence value.
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ public function quote($input, $type = ParameterType::STRING)
/**
* {@inheritdoc}
*/
public function exec($statement)
public function exec($sql)
{
$stmt = @db2_exec($this->conn, $statement);
$stmt = @db2_exec($this->conn, $sql);

if ($stmt === false) {
throw new DB2Exception(db2_stmt_errormsg());
Expand Down
16 changes: 8 additions & 8 deletions lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,31 +103,31 @@ public function bindValue($param, $value, $type = ParameterType::STRING)
/**
* {@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;
}

Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ public function requiresQueryForServerVersion()
/**
* {@inheritdoc}
*/
public function prepare($prepareString)
public function prepare($sql)
{
return new MysqliStatement($this->conn, $prepareString);
return new MysqliStatement($this->conn, $sql);
}

/**
Expand All @@ -157,9 +157,9 @@ public function quote($input, $type = ParameterType::STRING)
/**
* {@inheritdoc}
*/
public function exec($statement)
public function exec($sql)
{
if ($this->conn->query($statement) === false) {
if ($this->conn->query($sql) === false) {
throw new MysqliException($this->conn->error, $this->conn->sqlstate, $this->conn->errno);
}

Expand Down
10 changes: 5 additions & 5 deletions lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ public function __construct(mysqli $conn, $prepareString)
/**
* {@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;
}
Expand Down Expand Up @@ -179,7 +179,7 @@ public function execute($params = null)

// Bind row values _after_ storing the result. Otherwise, if mysqli is compiled with libmysql,
// it will have to allocate as much memory as it may be needed for the given column type
// (e.g. for a LONGBLOB field it's 4 gigabytes)
// (e.g. for a LONGBLOB column it's 4 gigabytes)
// @link https://bugs.php.net/bug.php?id=51386#1270673122
//
// Make sure that the values are bound after each execution. Otherwise, if closeCursor() has been
Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ public function requiresQueryForServerVersion()
/**
* {@inheritdoc}
*/
public function prepare($prepareString)
public function prepare($sql)
{
return new OCI8Statement($this->dbh, $prepareString, $this);
return new OCI8Statement($this->dbh, $sql, $this);
}

/**
Expand Down Expand Up @@ -140,9 +140,9 @@ public function quote($value, $type = ParameterType::STRING)
/**
* {@inheritdoc}
*/
public function exec($statement)
public function exec($sql)
{
$stmt = $this->prepare($statement);
$stmt = $this->prepare($sql);
$stmt->execute();

return $stmt->rowCount();
Expand Down
10 changes: 5 additions & 5 deletions lib/Doctrine/DBAL/Driver/PDOConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public function __construct($dsn, $user = null, $password = null, ?array $option
/**
* {@inheritdoc}
*/
public function exec($statement)
public function exec($sql)
{
try {
$result = parent::exec($statement);
$result = parent::exec($sql);
assert($result !== false);

return $result;
Expand All @@ -57,15 +57,15 @@ public function getServerVersion()
}

/**
* @param string $prepareString
* @param string $sql
* @param array<int, int> $driverOptions
*
* @return \PDOStatement
*/
public function prepare($prepareString, $driverOptions = [])
public function prepare($sql, $driverOptions = [])
{
try {
$statement = parent::prepare($prepareString, $driverOptions);
$statement = parent::prepare($sql, $driverOptions);
assert($statement instanceof \PDOStatement);

return $statement;
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Driver/PDOSqlsrv/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -23,7 +23,7 @@ public function bindParam($column, &$variable, $type = ParameterType::STRING, $l
$driverOptions = PDO::SQLSRV_ENCODING_BINARY;
}

return parent::bindParam($column, $variable, $type, $length, $driverOptions);
return parent::bindParam($param, $variable, $type, $length, $driverOptions);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/DBAL/Driver/PDOStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,20 @@ public function bindValue($param, $value, $type = ParameterType::STRING)
}

/**
* @param mixed $column
* @param mixed $param
* @param mixed $variable
* @param int $type
* @param int|null $length
* @param mixed $driverOptions
*
* @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);
}
Expand Down
F438
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ public function errorInfo()
/**
* {@inheritdoc}
*/
public function exec($statement)
public function exec($sql)
{
if (sasql_real_query($this->connection, $statement) === false) {
if (sasql_real_query($this->connection, $sql) === false) {
throw SQLAnywhereException::fromSQLAnywhereError($this->connection);
}

Expand Down Expand Up @@ -144,9 +144,9 @@ public function lastInsertId($name = null)
/**
* {@inheritdoc}
*/
public function prepare($prepareString)
public function prepare($sql)
{
return new SQLAnywhereStatement($this->connection, $prepareString);
return new SQLAnywhereStatement($this->connection, $sql);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ public function __construct($conn, $sql)
*
* @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:
Expand All @@ -116,9 +116,9 @@ public function bindParam($column, &$variable, $type = ParameterType::STRING, $l
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);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ public function quote($value, $type = ParameterType::STRING)
/**
* {@inheritDoc}
*/
public function exec($statement)
public function exec($sql)
{
$stmt = sqlsrv_query($this->conn, $statement);
$stmt = sqlsrv_query($this->conn, $sql);

if ($stmt === false) {
throw SQLSrvException::fromSqlSrvErrors();
Expand Down
Loading
0