check for empty charset

This commit is contained in:
Nash Tsai 2014-04-17 20:55:06 +08:00
parent fdb300db20
commit d3d1b7ce9a
1 changed files with 4 additions and 2 deletions

View File

@ -146,11 +146,13 @@ func (b *Base) CreateTableSql(table *Table, tableName, storeEngine, charset stri
sql += " ENGINE=" + storeEngine sql += " ENGINE=" + storeEngine
} }
if b.dialect.SupportCharset() { if b.dialect.SupportCharset() {
if charset == "" { if len(charset) == 0 {
charset = b.dialect.URI().Charset charset = b.dialect.URI().Charset
} }
if len(charset) > 0 {
sql += " DEFAULT CHARSET " + charset sql += " DEFAULT CHARSET " + charset
} }
}
sql += ";" sql += ";"
return sql return sql
} }