tidy up appearance of the alreadyQuoted SQL string

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
Andrew Thornton 2020-08-31 13:20:33 +01:00
parent cd10389e15
commit e50415a956
No known key found for this signature in database
GPG Key ID: 3CDE74631F13A748
1 changed files with 6 additions and 6 deletions

View File

@ -307,12 +307,12 @@ func (db *mysql) AddColumnSQL(tableName string, col *schemas.Column) string {
func (db *mysql) GetColumns(queryer core.Queryer, ctx context.Context, tableName string) ([]string, map[string]*schemas.Column, error) { func (db *mysql) GetColumns(queryer core.Queryer, ctx context.Context, tableName string) ([]string, map[string]*schemas.Column, error) {
args := []interface{}{db.uri.DBName, tableName} args := []interface{}{db.uri.DBName, tableName}
alreadyQuoted := `(INSTR(VERSION(), 'maria') > 0 && alreadyQuoted := "(INSTR(VERSION(), 'maria') > 0 && " +
(SUBSTRING_INDEX(VERSION(), '.', 1) > 10 || "(SUBSTRING_INDEX(VERSION(), '.', 1) > 10 || " +
(SUBSTRING_INDEX(VERSION(), '.', 1) = 10 && "(SUBSTRING_INDEX(VERSION(), '.', 1) = 10 && " +
(SUBSTRING_INDEX(SUBSTRING(VERSION(), 4), '.', 1) > 2 || "(SUBSTRING_INDEX(SUBSTRING(VERSION(), 4), '.', 1) > 2 || " +
(SUBSTRING_INDEX(SUBSTRING(VERSION(), 4), '.', 1) = 2 && "(SUBSTRING_INDEX(SUBSTRING(VERSION(), 4), '.', 1) = 2 && " +
SUBSTRING_INDEX(SUBSTRING(VERSION(), 6), '-', 1) >= 7)))))` "SUBSTRING_INDEX(SUBSTRING(VERSION(), 6), '-', 1) >= 7)))))"
s := "SELECT `COLUMN_NAME`, `IS_NULLABLE`, `COLUMN_DEFAULT`, `COLUMN_TYPE`," + s := "SELECT `COLUMN_NAME`, `IS_NULLABLE`, `COLUMN_DEFAULT`, `COLUMN_TYPE`," +
" `COLUMN_KEY`, `EXTRA`, `COLUMN_COMMENT`, " + " `COLUMN_KEY`, `EXTRA`, `COLUMN_COMMENT`, " +
alreadyQuoted + " AS NEEDS_QUOTE " + alreadyQuoted + " AS NEEDS_QUOTE " +