From bd1487ba5558424d9f191c922be397cb006e1242 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 29 May 2014 16:53:23 +0800 Subject: [PATCH] bug fixed --- mssql_dialect.go | 6 +++--- mysql_dialect.go | 7 ++++--- oracle_dialect.go | 6 +++--- postgres_dialect.go | 6 +++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/mssql_dialect.go b/mssql_dialect.go index ebc35164..5cd2f52b 100644 --- a/mssql_dialect.go +++ b/mssql_dialect.go @@ -62,10 +62,10 @@ func (db *mssql) SqlType(c *core.Column) string { var hasLen1 bool = (c.Length > 0) var hasLen2 bool = (c.Length2 > 0) - if hasLen1 { - res += "(" + strconv.Itoa(c.Length) + ")" - } else if hasLen2 { + if hasLen2 { res += "(" + strconv.Itoa(c.Length) + "," + strconv.Itoa(c.Length2) + ")" + } else if hasLen1 { + res += "(" + strconv.Itoa(c.Length) + ")" } return res } diff --git a/mysql_dialect.go b/mysql_dialect.go index e76830ab..4e430165 100644 --- a/mysql_dialect.go +++ b/mysql_dialect.go @@ -70,10 +70,11 @@ func (db *mysql) SqlType(c *core.Column) string { var hasLen1 bool = (c.Length > 0) var hasLen2 bool = (c.Length2 > 0) - if hasLen1 { - res += "(" + strconv.Itoa(c.Length) + ")" - } else if hasLen2 { + + if hasLen2 { res += "(" + strconv.Itoa(c.Length) + "," + strconv.Itoa(c.Length2) + ")" + } else if hasLen1 { + res += "(" + strconv.Itoa(c.Length) + ")" } return res } diff --git a/oracle_dialect.go b/oracle_dialect.go index 73300c1a..e23ab297 100644 --- a/oracle_dialect.go +++ b/oracle_dialect.go @@ -44,10 +44,10 @@ func (db *oracle) SqlType(c *core.Column) string { var hasLen1 bool = (c.Length > 0) var hasLen2 bool = (c.Length2 > 0) - if hasLen1 { - res += "(" + strconv.Itoa(c.Length) + ")" - } else if hasLen2 { + if hasLen2 { res += "(" + strconv.Itoa(c.Length) + "," + strconv.Itoa(c.Length2) + ")" + } else if hasLen1 { + res += "(" + strconv.Itoa(c.Length) + ")" } return res } diff --git a/postgres_dialect.go b/postgres_dialect.go index 58e8da4f..61e75881 100644 --- a/postgres_dialect.go +++ b/postgres_dialect.go @@ -59,10 +59,10 @@ func (db *postgres) SqlType(c *core.Column) string { var hasLen1 bool = (c.Length > 0) var hasLen2 bool = (c.Length2 > 0) - if hasLen1 { - res += "(" + strconv.Itoa(c.Length) + ")" - } else if hasLen2 { + if hasLen2 { res += "(" + strconv.Itoa(c.Length) + "," + strconv.Itoa(c.Length2) + ")" + } else if hasLen1 { + res += "(" + strconv.Itoa(c.Length) + ")" } return res }