|
|
@ -99,14 +99,14 @@ class QueryBuilder extends \yii\db\QueryBuilder |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Builds a SQL statement for enabling or disabling integrity check. |
|
|
|
* Builds a SQL statement for enabling or disabling integrity check. |
|
|
|
* @param boolean $check whether to turn on or off the integrity check. |
|
|
|
* @param boolean $check whether to turn on or off the integrity check. |
|
|
|
* @param string $table the table name. Meaningless for MySQL. |
|
|
|
* @param string $schema the schema of the tables. |
|
|
|
* @param string $schema the schema of the tables. Meaningless for MySQL. |
|
|
|
* @param string $table the table name. |
|
|
|
* @return string the SQL statement for checking integrity |
|
|
|
* @return string the SQL statement for checking integrity |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function checkIntegrity($check = true, $schema = '', $table = '') |
|
|
|
public function checkIntegrity($check = true, $schema = '', $table = '') |
|
|
|
{ |
|
|
|
{ |
|
|
|
$enable=$check ? 'ENABLE' : 'DISABLE'; |
|
|
|
$enable = $check ? 'ENABLE' : 'DISABLE'; |
|
|
|
$tableNames=$this->db->schema->findTableNames($schema); |
|
|
|
$tableNames = $table ? [$table] : $this->db->schema->findTableNames($schema); |
|
|
|
$command = ''; |
|
|
|
$command = ''; |
|
|
|
|
|
|
|
|
|
|
|
foreach($tableNames as $tableName) |
|
|
|
foreach($tableNames as $tableName) |
|
|
|