fix dump to other databases
This commit is contained in:
parent
44b70cccf4
commit
2189b36884
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue