From 2189b36884a485d1d609fc5690bfc71a8a7de8c3 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 3 Jan 2017 14:44:30 +0800 Subject: [PATCH] fix dump to other databases --- engine.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engine.go b/engine.go index 32597b5c..c56aa063 100644 --- a/engine.go +++ b/engine.go @@ -535,18 +535,21 @@ func (engine *Engine) dumpAll(w io.Writer, tp ...core.DbType) error { // DumpAll dump database all table structs and data to w with specify db type func (engine *Engine) dumpTables(tables []*core.Table, w io.Writer, tp ...core.DbType) error { var dialect core.Dialect + var distDBName string if len(tp) == 0 { dialect = engine.dialect + distDBName = string(engine.dialect.DBType()) } else { dialect = core.QueryDialect(tp[0]) if dialect == nil { return errors.New("Unsupported database type") } dialect.Init(nil, engine.dialect.URI(), "", "") + distDBName = string(tp[0]) } _, err := io.WriteString(w, fmt.Sprintf("/*Generated by xorm v%s %s, from %s to %s*/\n\n", - Version, time.Now().In(engine.TZLocation).Format("2006-01-02 15:04:05"), engine.dialect.DBType(), dialect.DBType())) + Version, time.Now().In(engine.TZLocation).Format("2006-01-02 15:04:05"), engine.dialect.DBType(), strings.ToUpper(distDBName))) if err != nil { return err }