diff --git a/engine.go b/engine.go index cdb2b541..44815f9f 100644 --- a/engine.go +++ b/engine.go @@ -373,12 +373,14 @@ func (engine *Engine) DumpAll(w io.Writer) error { } else if col.SQLType.IsText() || col.SQLType.IsTime() { var v = fmt.Sprintf("%s", d) temp += ", '" + strings.Replace(v, "'", "''", -1) + "'" - } else if col.SQLType.IsBlob() /**/ { + } else if col.SQLType.IsBlob() { if reflect.TypeOf(d).Kind() == reflect.Slice { temp += fmt.Sprintf(", %s", engine.dialect.FormatBytes(d.([]byte))) } else if reflect.TypeOf(d).Kind() == reflect.String { temp += fmt.Sprintf(", '%s'", d.(string)) } + } else if col.SQLType.IsNumeric() { + temp += fmt.Sprintf(", %s", string(d.([]byte))) } else { s := fmt.Sprintf("%v", d) if strings.Contains(s, ":") || strings.Contains(s, "-") { diff --git a/mssql_dialect.go b/mssql_dialect.go index 5cd2f52b..eee50795 100644 --- a/mssql_dialect.go +++ b/mssql_dialect.go @@ -168,7 +168,7 @@ where a.object_id=object_id('` + tableName + `')` } } - if col.SQLType.IsText() { + if col.SQLType.IsText() || col.SQLType.IsTime() { if col.Default != "" { col.Default = "'" + col.Default + "'" } else { diff --git a/mysql_dialect.go b/mysql_dialect.go index b7fdb01b..ee1f4e06 100644 --- a/mysql_dialect.go +++ b/mysql_dialect.go @@ -228,7 +228,7 @@ func (db *mysql) GetColumns(tableName string) ([]string, map[string]*core.Column col.IsAutoIncrement = true } - if col.SQLType.IsText() { + if col.SQLType.IsText() || col.SQLType.IsTime() { if col.Default != "" { col.Default = "'" + col.Default + "'" } else { diff --git a/oracle_dialect.go b/oracle_dialect.go index e23ab297..57da2c50 100644 --- a/oracle_dialect.go +++ b/oracle_dialect.go @@ -158,7 +158,7 @@ func (db *oracle) GetColumns(tableName string) ([]string, map[string]*core.Colum col.Length = dataLen - if col.SQLType.IsText() { + if col.SQLType.IsText() || col.SQLType.IsTime() { if col.Default != "" { col.Default = "'" + col.Default + "'" } else {