Commit cbad97c7 by Qiang Xue

change back the visibility of findTableNames to protected.

parent 70c23ca4
...@@ -280,7 +280,7 @@ class Schema extends \yii\db\Schema ...@@ -280,7 +280,7 @@ class Schema extends \yii\db\Schema
* @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema. * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
* @return array all table names in the database. The names have NO schema name prefix. * @return array all table names in the database. The names have NO schema name prefix.
*/ */
public function findTableNames($schema = '') protected function findTableNames($schema = '')
{ {
$sql = 'SHOW TABLES'; $sql = 'SHOW TABLES';
if ($schema !== '') { if ($schema !== '') {
......
...@@ -109,7 +109,7 @@ class QueryBuilder extends \yii\db\QueryBuilder ...@@ -109,7 +109,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
{ {
$enable = $check ? 'ENABLE' : 'DISABLE'; $enable = $check ? 'ENABLE' : 'DISABLE';
$schema = $schema ? $schema : $this->db->schema->defaultSchema; $schema = $schema ? $schema : $this->db->schema->defaultSchema;
$tableNames = $table ? [$table] : $this->db->schema->findTableNames($schema); $tableNames = $table ? [$table] : $this->db->schema->getTableNames($schema);
$command = ''; $command = '';
foreach ($tableNames as $tableName) { foreach ($tableNames as $tableName) {
......
...@@ -158,7 +158,7 @@ class Schema extends \yii\db\Schema ...@@ -158,7 +158,7 @@ class Schema extends \yii\db\Schema
* @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema. * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
* @return array all table names in the database. The names have NO schema name prefix. * @return array all table names in the database. The names have NO schema name prefix.
*/ */
public function findTableNames($schema = '') protected function findTableNames($schema = '')
{ {
if ($schema === '') { if ($schema === '') {
$schema = $this->defaultSchema; $schema = $this->defaultSchema;
......
...@@ -87,7 +87,7 @@ class Schema extends \yii\db\Schema ...@@ -87,7 +87,7 @@ class Schema extends \yii\db\Schema
* If not empty, the returned table names will be prefixed with the schema name. * If not empty, the returned table names will be prefixed with the schema name.
* @return array all table names in the database. * @return array all table names in the database.
*/ */
public function findTableNames($schema = '') protected function findTableNames($schema = '')
{ {
$sql = "SELECT DISTINCT tbl_name FROM sqlite_master WHERE tbl_name<>'sqlite_sequence'"; $sql = "SELECT DISTINCT tbl_name FROM sqlite_master WHERE tbl_name<>'sqlite_sequence'";
return $this->db->createCommand($sql)->queryColumn(); return $this->db->createCommand($sql)->queryColumn();
......
...@@ -11,7 +11,7 @@ use yii\db\Schema; ...@@ -11,7 +11,7 @@ use yii\db\Schema;
*/ */
class SchemaTest extends DatabaseTestCase class SchemaTest extends DatabaseTestCase
{ {
public function testFindTableNames() public function testGetTableNames()
{ {
/** @var Schema $schema */ /** @var Schema $schema */
$schema = $this->getConnection()->schema; $schema = $this->getConnection()->schema;
......
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