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,10 +146,12 @@ func (b *Base) CreateTableSql(table *Table, tableName, storeEngine, charset stri
sql += " ENGINE=" + storeEngine
}
if b.dialect.SupportCharset() {
if charset == "" {
if len(charset) == 0 {
charset = b.dialect.URI().Charset
}
sql += " DEFAULT CHARSET " + charset
if len(charset) > 0 {
sql += " DEFAULT CHARSET " + charset
}
}
sql += ";"
return sql