Browse Source

Have I fixed these phpdocs? Let’s see…

tags/2.0.13
Sergey Makinen 7 years ago
parent
commit
164d3c83e9
No known key found for this signature in database
GPG Key ID: D227B0B214A978D6
  1. 2
      framework/db/CheckConstraint.php
  2. 12
      framework/db/Command.php
  3. 10
      framework/db/QueryBuilder.php
  4. 12
      framework/db/Schema.php
  5. 17
      framework/db/SqlToken.php
  6. 10
      framework/db/SqlTokenizer.php
  7. 2
      framework/db/cubrid/QueryBuilder.php
  8. 9
      framework/db/cubrid/Schema.php
  9. 4
      framework/db/mssql/QueryBuilder.php
  10. 17
      framework/db/mssql/Schema.php
  11. 2
      framework/db/mysql/QueryBuilder.php
  12. 15
      framework/db/mysql/Schema.php
  13. 15
      framework/db/oci/Schema.php
  14. 15
      framework/db/pgsql/Schema.php
  15. 4
      framework/db/sqlite/QueryBuilder.php
  16. 10
      framework/db/sqlite/Schema.php

2
framework/db/CheckConstraint.php

@ -16,7 +16,7 @@ namespace yii\db;
class CheckConstraint extends Constraint class CheckConstraint extends Constraint
{ {
/** /**
* @var string * @var string the SQL of the `CHECK` constraint.
*/ */
public $expression; public $expression;
} }

12
framework/db/Command.php

@ -780,13 +780,13 @@ class Command extends Component
* The name will be properly quoted by the method. * The name will be properly quoted by the method.
* @param string $table the table that the check constraint will be added to. * @param string $table the table that the check constraint will be added to.
* The name will be properly quoted by the method. * The name will be properly quoted by the method.
* @param string $check the SQL of the `CHECK` constraint. * @param string $expression the SQL of the `CHECK` constraint.
* @return $this the command object itself. * @return $this the command object itself.
* @since 2.0.13 * @since 2.0.13
*/ */
public function addCheck($name, $table, $check) public function addCheck($name, $table, $expression)
{ {
$sql = $this->db->getQueryBuilder()->addCheck($name, $table, $check); $sql = $this->db->getQueryBuilder()->addCheck($name, $table, $expression);
return $this->setSql($sql)->requireTableSchemaRefresh($table); return $this->setSql($sql)->requireTableSchemaRefresh($table);
} }
@ -815,13 +815,13 @@ class Command extends Component
* The name will be properly quoted by the method. * The name will be properly quoted by the method.
* @param string $column the name of the column to that the constraint will be added on. * @param string $column the name of the column to that the constraint will be added on.
* The name will be properly quoted by the method. * The name will be properly quoted by the method.
* @param mixed $default default value. * @param mixed $value default value.
* @return $this the command object itself. * @return $this the command object itself.
* @since 2.0.13 * @since 2.0.13
*/ */
public function addDefaultValue($name, $table, $column, $default) public function addDefaultValue($name, $table, $column, $value)
{ {
$sql = $this->db->getQueryBuilder()->addDefaultValue($name, $table, $column, $default); $sql = $this->db->getQueryBuilder()->addDefaultValue($name, $table, $column, $value);
return $this->setSql($sql)->requireTableSchemaRefresh($table); return $this->setSql($sql)->requireTableSchemaRefresh($table);
} }

10
framework/db/QueryBuilder.php

@ -655,14 +655,14 @@ class QueryBuilder extends \yii\base\Object
* The name will be properly quoted by the method. * The name will be properly quoted by the method.
* @param string $table the table that the check constraint will be added to. * @param string $table the table that the check constraint will be added to.
* The name will be properly quoted by the method. * The name will be properly quoted by the method.
* @param string $check the SQL of the `CHECK` constraint. * @param string $expression the SQL of the `CHECK` constraint.
* @return string the SQL statement for adding a check constraint to an existing table. * @return string the SQL statement for adding a check constraint to an existing table.
* @since 2.0.13 * @since 2.0.13
*/ */
public function addCheck($name, $table, $check) public function addCheck($name, $table, $expression)
{ {
return 'ALTER TABLE ' . $this->db->quoteTableName($table) . ' ADD CONSTRAINT ' return 'ALTER TABLE ' . $this->db->quoteTableName($table) . ' ADD CONSTRAINT '
. $this->db->quoteColumnName($name) . ' CHECK (' . $this->db->quoteSql($check) . ')'; . $this->db->quoteColumnName($name) . ' CHECK (' . $this->db->quoteSql($expression) . ')';
} }
/** /**
@ -688,12 +688,12 @@ class QueryBuilder extends \yii\base\Object
* The name will be properly quoted by the method. * The name will be properly quoted by the method.
* @param string $column the name of the column to that the constraint will be added on. * @param string $column the name of the column to that the constraint will be added on.
* The name will be properly quoted by the method. * The name will be properly quoted by the method.
* @param mixed $default default value. * @param mixed $value default value.
* @return string the SQL statement for adding a default value constraint to an existing table. * @return string the SQL statement for adding a default value constraint to an existing table.
* @throws NotSupportedException if this is not supported by the underlying DBMS. * @throws NotSupportedException if this is not supported by the underlying DBMS.
* @since 2.0.13 * @since 2.0.13
*/ */
public function addDefaultValue($name, $table, $column, $default) public function addDefaultValue($name, $table, $column, $value)
{ {
throw new NotSupportedException($this->db->getDriverName() . ' does not support adding default value constraints.'); throw new NotSupportedException($this->db->getDriverName() . ' does not support adding default value constraints.');
} }

12
framework/db/Schema.php

@ -643,7 +643,7 @@ abstract class Schema extends Object
$cache = $schemaCache; $cache = $schemaCache;
} }
} }
if (!isset($this->_tableMetadata[$name]) || $refresh) { if ($refresh || !isset($this->_tableMetadata[$name])) {
$this->loadTableMetadataFromCache($cache, $name); $this->loadTableMetadataFromCache($cache, $name);
} }
if (!array_key_exists($type, $this->_tableMetadata[$name])) { if (!array_key_exists($type, $this->_tableMetadata[$name])) {
@ -703,13 +703,13 @@ abstract class Schema extends Object
return $row; return $row;
} }
if (!$multiple) { if ($multiple) {
return array_change_key_case($row, CASE_LOWER); return array_map(function (array $row) {
return array_change_key_case($row, CASE_LOWER);
}, $row);
} }
return array_map(function (array $row) { return array_change_key_case($row, CASE_LOWER);
return array_change_key_case($row, CASE_LOWER);
}, $row);
} }
/** /**

17
framework/db/SqlToken.php

@ -63,7 +63,7 @@ class SqlToken extends Object implements \ArrayAccess
public $parent; public $parent;
/** /**
* @var SqlToken[] * @var SqlToken[] token children.
*/ */
private $_children = []; private $_children = [];
@ -194,11 +194,14 @@ class SqlToken extends Object implements \ArrayAccess
} }
/** /**
* @param string $pattern * Returns whether this token (including its children) matches the specified "pattern" SQL code.
* @param int $offset * Currently this implementation uses [[\yii\db\sqlite\SqlTokenizer]] to process a pattern SQL code.
* @param int|null $firstMatchIndex * @param string $pattern SQL code. Everything supported in SQLite is supported here as well.
* @param int|null $lastMatchIndex * In addition, `any` keyword is supported which is treated as any number of keywords, identifiers, whitespaces.
* @return bool * @param int $offset token children offset to start lookup with.
* @param int|null $firstMatchIndex token children offset where a successful match begins.
* @param int|null $lastMatchIndex token children offset where a successful match ends.
* @return bool whether this token matches the pattern SQL code.
*/ */
public function matches($pattern, $offset = 0, &$firstMatchIndex = null, &$lastMatchIndex = null) public function matches($pattern, $offset = 0, &$firstMatchIndex = null, &$lastMatchIndex = null)
{ {
@ -237,6 +240,8 @@ class SqlToken extends Object implements \ArrayAccess
$firstMatchIndex = $lastMatchIndex = null; $firstMatchIndex = $lastMatchIndex = null;
$wildcard = false; $wildcard = false;
for ($index = 0, $count = count($patternToken->children); $index < $count; $index++) { for ($index = 0, $count = count($patternToken->children); $index < $count; $index++) {
// Here we iterate token by token with an exception of "any" that toggles
// an iteration until we matched with a next pattern token or EOF.
if ($patternToken[$index]->content === 'any') { if ($patternToken[$index]->content === 'any') {
$wildcard = true; $wildcard = true;
continue; continue;

10
framework/db/SqlTokenizer.php

@ -34,23 +34,23 @@ abstract class SqlTokenizer extends Object
protected $offset; protected $offset;
/** /**
* @var \SplStack * @var \SplStack stack of active tokens.
*/ */
private $_tokenStack; private $_tokenStack;
/** /**
* @var SqlToken * @var SqlToken active token. It's usually a top of the token stack.
*/ */
private $_currentToken; private $_currentToken;
/** /**
* @var string[] * @var string[] cached substrings.
*/ */
private $_substrings; private $_substrings;
/** /**
* @var string * @var string current buffer value.
*/ */
private $_buffer = ''; private $_buffer = '';
/** /**
* @var SqlToken * @var SqlToken resulting token of a last [[tokenize()]] call.
*/ */
private $_token; private $_token;

2
framework/db/cubrid/QueryBuilder.php

@ -140,7 +140,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
* @inheritDoc * @inheritDoc
* @throws NotSupportedException this is not supported by CUBRID. * @throws NotSupportedException this is not supported by CUBRID.
*/ */
public function addCheck($name, $table, $check) public function addCheck($name, $table, $expression)
{ {
throw new NotSupportedException(__METHOD__ . ' is not supported by CUBRID.'); throw new NotSupportedException(__METHOD__ . ' is not supported by CUBRID.');
} }

9
framework/db/cubrid/Schema.php

@ -391,9 +391,12 @@ class Schema extends \yii\db\Schema
} }
/** /**
* @param string $tableName * Loads multiple types of constraints and returns the specified ones.
* @param string $returnType * @param string $tableName table name.
* @return mixed * @param string $returnType return type:
* - indexes
* - uniques
* @return mixed constraints.
*/ */
private function loadTableConstraints($tableName, $returnType) private function loadTableConstraints($tableName, $returnType)
{ {

4
framework/db/mssql/QueryBuilder.php

@ -179,10 +179,10 @@ class QueryBuilder extends \yii\db\QueryBuilder
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function addDefaultValue($name, $table, $column, $default) public function addDefaultValue($name, $table, $column, $value)
{ {
return 'ALTER TABLE ' . $this->db->quoteTableName($table) . ' ADD CONSTRAINT ' return 'ALTER TABLE ' . $this->db->quoteTableName($table) . ' ADD CONSTRAINT '
. $this->db->quoteColumnName($name) . ' DEFAULT ' . $this->db->quoteValue($default) . ' FOR ' . $this->db->quoteColumnName($name) . ' DEFAULT ' . $this->db->quoteValue($value) . ' FOR '
. $this->db->quoteColumnName($column); . $this->db->quoteColumnName($column);
} }

17
framework/db/mssql/Schema.php

@ -158,11 +158,10 @@ SQL;
$this->findPrimaryKeys($table); $this->findPrimaryKeys($table);
if ($this->findColumns($table)) { if ($this->findColumns($table)) {
$this->findForeignKeys($table); $this->findForeignKeys($table);
return $table; return $table;
} else {
return null;
} }
return null;
} }
/** /**
@ -594,9 +593,15 @@ SQL;
} }
/** /**
* @param string $tableName * Loads multiple types of constraints and returns the specified ones.
* @param string $returnType * @param string $tableName table name.
* @return mixed * @param string $returnType return type:
* - primaryKey
* - foreignKeys
* - uniques
* - checks
* - defaults
* @return mixed constraints.
*/ */
private function loadTableConstraints($tableName, $returnType) private function loadTableConstraints($tableName, $returnType)
{ {

2
framework/db/mysql/QueryBuilder.php

@ -132,7 +132,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
* @inheritDoc * @inheritDoc
* @throws NotSupportedException this is not supported by MySQL. * @throws NotSupportedException this is not supported by MySQL.
*/ */
public function addCheck($name, $table, $check) public function addCheck($name, $table, $expression)
{ {
throw new NotSupportedException(__METHOD__ . ' is not supported by MySQL.'); throw new NotSupportedException(__METHOD__ . ' is not supported by MySQL.');
} }

15
framework/db/mysql/Schema.php

@ -110,11 +110,10 @@ class Schema extends \yii\db\Schema
if ($this->findColumns($table)) { if ($this->findColumns($table)) {
$this->findConstraints($table); $this->findConstraints($table);
return $table; return $table;
} else {
return null;
} }
return null;
} }
/** /**
@ -482,9 +481,13 @@ SQL;
} }
/** /**
* @param string $tableName * Loads multiple types of constraints and returns the specified ones.
* @param string $returnType * @param string $tableName table name.
* @return mixed * @param string $returnType return type:
* - primaryKey
* - foreignKeys
* - uniques
* @return mixed constraints.
*/ */
private function loadTableConstraints($tableName, $returnType) private function loadTableConstraints($tableName, $returnType)
{ {

15
framework/db/oci/Schema.php

@ -142,9 +142,9 @@ SQL;
if ($this->findColumns($table)) { if ($this->findColumns($table)) {
$this->findConstraints($table); $this->findConstraints($table);
return $table; return $table;
} else {
return null;
} }
return null;
} }
/** /**
@ -630,9 +630,14 @@ SQL;
} }
/** /**
* @param string $tableName * Loads multiple types of constraints and returns the specified ones.
* @param string $returnType * @param string $tableName table name.
* @return mixed * @param string $returnType return type:
* - primaryKey
* - foreignKeys
* - uniques
* - checks
* @return mixed constraints.
*/ */
private function loadTableConstraints($tableName, $returnType) private function loadTableConstraints($tableName, $returnType)
{ {

15
framework/db/pgsql/Schema.php

@ -179,9 +179,9 @@ SQL;
if ($this->findColumns($table)) { if ($this->findColumns($table)) {
$this->findConstraints($table); $this->findConstraints($table);
return $table; return $table;
} else {
return null;
} }
return null;
} }
/** /**
@ -609,9 +609,14 @@ SQL;
} }
/** /**
* @param string $tableName * Loads multiple types of constraints and returns the specified ones.
* @param string $returnType * @param string $tableName table name.
* @return mixed * @param string $returnType return type:
* - primaryKey
* - foreignKeys
* - uniques
* - checks
* @return mixed constraints.
*/ */
private function loadTableConstraints($tableName, $returnType) private function loadTableConstraints($tableName, $returnType)
{ {

4
framework/db/sqlite/QueryBuilder.php

@ -321,7 +321,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
* @inheritDoc * @inheritDoc
* @throws NotSupportedException this is not supported by SQLite. * @throws NotSupportedException this is not supported by SQLite.
*/ */
public function addCheck($name, $table, $check) public function addCheck($name, $table, $expression)
{ {
throw new NotSupportedException(__METHOD__ . ' is not supported by SQLite.'); throw new NotSupportedException(__METHOD__ . ' is not supported by SQLite.');
} }
@ -339,7 +339,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
* @inheritDoc * @inheritDoc
* @throws NotSupportedException this is not supported by SQLite. * @throws NotSupportedException this is not supported by SQLite.
*/ */
public function addDefaultValue($name, $table, $column, $default) public function addDefaultValue($name, $table, $column, $value)
{ {
throw new NotSupportedException(__METHOD__ . ' is not supported by SQLite.'); throw new NotSupportedException(__METHOD__ . ' is not supported by SQLite.');
} }

10
framework/db/sqlite/Schema.php

@ -382,9 +382,13 @@ class Schema extends \yii\db\Schema
} }
/** /**
* @param string $tableName * Loads multiple types of constraints and returns the specified ones.
* @param string $returnType * @param string $tableName table name.
* @return mixed * @param string $returnType return type:
* - primaryKey
* - indexes
* - uniques
* @return mixed constraints.
*/ */
private function loadTableConstraints($tableName, $returnType) private function loadTableConstraints($tableName, $returnType)
{ {

Loading…
Cancel
Save