public function getTableComment(TableSchema $table, $indent = 0)
    {

        if (null === $this->_tableStatus) {
            try {
                // 不知 “SHOW TABLE STATUS” sql语句在其他数据库中是否会执行成功，所以用try catch捕获异常
                $this->_tableStatus = $this->db->createCommand('SHOW TABLE STATUS')->queryAll();
            } catch (\Exception $e) {
                return '';
            }
        }

        $textIndent = $this->textIndent($indent);
        $definition = $textIndent . '$this->runSuccess[\'addTableComment\'] = ';
        $tableName = static::removePrefix($table->name, $this->db->tablePrefix);

        foreach ($this->_tableStatus as $value) {
            if ($table->name === $value['Name'] && ! empty($value['Comment'])) {
                $comment = addslashes($value['Comment']);
                return $definition . "\$this->addCommentOnTable('{{%$tableName}}', '{$comment}');";
            }
        }

        return '';
    }
public function getTableComment(TableSchema $table, $indent = 0)
    {

        if (null === $this->_tableStatus) {
            try {
                // 不知 “SHOW TABLE STATUS” sql语句在其他数据库中是否会执行成功，所以用try catch捕获异常
                $this->_tableStatus = $this->db->createCommand('SHOW TABLE STATUS')->queryAll();
            } catch (\Exception $e) {
                return '';
            }
        }

        $textIndent = $this->textIndent($indent);
        $definition = $textIndent . '$this->runSuccess[\'addTableComment\'] = ';
        $tableName = static::removePrefix($table->name, $this->db->tablePrefix);

        foreach ($this->_tableStatus as $value) {
            if ($table->name === $value['Name'] && ! empty($value['Comment'])) {
                $comment = addslashes($value['Comment']);
                return $definition . "\$this->addCommentOnTable('{{%$tableName}}', '{$comment}');";
            }
        }

        return '';
    }
public function getTableComment ( TableSchema $ table , $ indent = 0 ) { if ( null === $ this -> _tableStatus ) { try { // 不知 “SHOW TABLE STATUS” sql语句在其他数据库中是否会执行成功，所以用try catch捕获异常 $ this -> _tableStatus = $ this -> db -> createCommand ( 'SHOW TABLE STATUS' ) -> queryAll ( ) ; } catch ( \ Exception $ e ) { return '' ; } } $ textIndent = $ this -> textIndent ( $ indent ) ; $ definition = $ textIndent . '$this->runSuccess[\'addTableComment\'] = ' ; $ tableName = static :: removePrefix ( $ table -> name , $ this -> db -> tablePrefix ) ; foreach ( $ this -> _tableStatus as $ value ) { if ( $ table -> name === $ value [ 'Name' ] && ! empty ( $ value [ 'Comment' ] ) ) { $ comment = addslashes ( $ value [ 'Comment' ] ) ; return $ definition . "\$this->addCommentOnTable('{{%$tableName}}', '{$comment}');" ; } } return '' ; }
get table comment
@param TableSchema $table
@param int $indent the number of text indent
@return string
get table comment