Skip to content

Commit

Permalink
Rename method arguments to use camelCase casing (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
nibra authored Dec 15, 2020
1 parent 90cab6c commit b36f97b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 36 deletions.
28 changes: 14 additions & 14 deletions src/Pgsql/PgsqlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private function getDefaultSchema()

return $this->loadResult();
}

/**
* Shows the table CREATE statement that creates the given tables.
*
Expand Down Expand Up @@ -204,7 +204,7 @@ public function getTableColumns($table, $typeOnly = true)
$tableSub = $this->replacePrefix($table);

$defaultSchema = $this->getDefaultSchema();

$this->setQuery('
SELECT a.attname AS "column_name",
pg_catalog.format_type(a.atttypid, a.atttypmod) as "type",
Expand Down Expand Up @@ -492,26 +492,26 @@ public function renameTable($oldTable, $newTable, $backup = null, $prefix = null
/**
* This function return a field value as a prepared string to be used in a SQL statement.
*
* @param array $columns Array of table's column returned by ::getTableColumns.
* @param string $field_name The table field's name.
* @param string $field_value The variable value to quote and return.
* @param array $columns Array of table's column returned by ::getTableColumns.
* @param string $fieldName The table field's name.
* @param string $fieldValue The variable value to quote and return.
*
* @return string The quoted string.
*
* @since 1.5.0
*/
public function sqlValue($columns, $field_name, $field_value)
public function sqlValue($columns, $fieldName, $fieldValue)
{
switch ($columns[$field_name])
switch ($columns[$fieldName])
{
case 'boolean':
$val = 'NULL';

if ($field_value === 't' || $field_value === true || $field_value === 1 || $field_value === '1')
if ($fieldValue === 't' || $fieldValue === true || $fieldValue === 1 || $fieldValue === '1')
{
$val = 'TRUE';
}
elseif ($field_value === 'f' || $field_value === false || $field_value === 0 || $field_value === '0')
elseif ($fieldValue === 'f' || $fieldValue === false || $fieldValue === 0 || $fieldValue === '0')
{
$val = 'FALSE';
}
Expand All @@ -527,23 +527,23 @@ public function sqlValue($columns, $field_name, $field_value)
case 'smallint':
case 'serial':
case 'numeric,':
$val = $field_value === '' ? 'NULL' : $field_value;
$val = $fieldValue === '' ? 'NULL' : $fieldValue;

break;

case 'date':
case 'timestamp without time zone':
if (empty($field_value))
if (empty($fieldValue))
{
$field_value = $this->getNullDate();
$fieldValue = $this->getNullDate();
}

$val = $this->quote($field_value);
$val = $this->quote($fieldValue);

break;

default:
$val = $this->quote($field_value);
$val = $this->quote($fieldValue);

break;
}
Expand Down
24 changes: 12 additions & 12 deletions src/Postgresql/PostgresqlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -986,26 +986,26 @@ public function setUtf()
/**
* This function return a field value as a prepared string to be used in a SQL statement.
*
* @param array $columns Array of table's column returned by ::getTableColumns.
* @param string $field_name The table field's name.
* @param string $field_value The variable value to quote and return.
* @param array $columns Array of table's column returned by ::getTableColumns.
* @param string $fieldName The table field's name.
* @param string $fieldValue The variable value to quote and return.
*
* @return string The quoted string.
*
* @since 1.0
*/
public function sqlValue($columns, $field_name, $field_value)
public function sqlValue($columns, $fieldName, $fieldValue)
{
switch ($columns[$field_name])
switch ($columns[$fieldName])
{
case 'boolean':
$val = 'NULL';

if ($field_value === 't' || $field_value === true || $field_value === 1 || $field_value === '1')
if ($fieldValue === 't' || $fieldValue === true || $fieldValue === 1 || $fieldValue === '1')
{
$val = 'TRUE';
}
elseif ($field_value === 'f' || $field_value === false || $field_value === 0 || $field_value === '0')
elseif ($fieldValue === 'f' || $fieldValue === false || $fieldValue === 0 || $fieldValue === '0')
{
$val = 'FALSE';
}
Expand All @@ -1021,23 +1021,23 @@ public function sqlValue($columns, $field_name, $field_value)
case 'smallint':
case 'serial':
case 'numeric,':
$val = $field_value === '' ? 'NULL' : $field_value;
$val = $fieldValue === '' ? 'NULL' : $fieldValue;

break;

case 'date':
case 'timestamp without time zone':
if (empty($field_value))
if (empty($fieldValue))
{
$field_value = $this->getNullDate();
$fieldValue = $this->getNullDate();
}

$val = $this->quote($field_value);
$val = $this->quote($fieldValue);

break;

default:
$val = $this->quote($field_value);
$val = $this->quote($fieldValue);

break;
}
Expand Down
20 changes: 10 additions & 10 deletions src/Postgresql/PostgresqlQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,25 +434,25 @@ public function currentTimestamp()
/**
* Sets the FOR UPDATE lock on select's output row
*
* @param string $table_name The table to lock
* @param string $glue The glue by which to join the conditions. Defaults to ',' .
* @param string $tableName The table to lock
* @param string $glue The glue by which to join the conditions. Defaults to ',' .
*
* @return PostgresqlQuery FOR UPDATE query element
*
* @since 1.0
*/
public function forUpdate($table_name, $glue = ',')
public function forUpdate($tableName, $glue = ',')
{
$this->type = 'forUpdate';

if ($this->forUpdate === null)
{
$glue = strtoupper($glue);
$this->forUpdate = new QueryElement('FOR UPDATE', 'OF ' . $table_name, "$glue ");
$this->forUpdate = new QueryElement('FOR UPDATE', 'OF ' . $tableName, "$glue ");
}
else
{
$this->forUpdate->append($table_name);
$this->forUpdate->append($tableName);
}

return $this;
Expand All @@ -461,25 +461,25 @@ public function forUpdate($table_name, $glue = ',')
/**
* Sets the FOR SHARE lock on select's output row
*
* @param string $table_name The table to lock
* @param string $glue The glue by which to join the conditions. Defaults to ',' .
* @param string $tableName The table to lock
* @param string $glue The glue by which to join the conditions. Defaults to ',' .
*
* @return PostgresqlQuery FOR SHARE query element
*
* @since 1.0
*/
public function forShare($table_name, $glue = ',')
public function forShare($tableName, $glue = ',')
{
$this->type = 'forShare';

if ($this->forShare === null)
{
$glue = strtoupper($glue);
$this->forShare = new QueryElement('FOR SHARE', 'OF ' . $table_name, "$glue ");
$this->forShare = new QueryElement('FOR SHARE', 'OF ' . $tableName, "$glue ");
}
else
{
$this->forShare->append($table_name);
$this->forShare->append($tableName);
}

return $this;
Expand Down

0 comments on commit b36f97b

Please sign in to comment.