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
|
// 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 {
|
func (engine *Engine) dumpTables(tables []*core.Table, w io.Writer, tp ...core.DbType) error {
|
||||||
var dialect core.Dialect
|
var dialect core.Dialect
|
||||||
|
var distDBName string
|
||||||
if len(tp) == 0 {
|
if len(tp) == 0 {
|
||||||
dialect = engine.dialect
|
dialect = engine.dialect
|
||||||
|
distDBName = string(engine.dialect.DBType())
|
||||||
} else {
|
} else {
|
||||||
dialect = core.QueryDialect(tp[0])
|
dialect = core.QueryDialect(tp[0])
|
||||||
if dialect == nil {
|
if dialect == nil {
|
||||||
return errors.New("Unsupported database type")
|
return errors.New("Unsupported database type")
|
||||||
}
|
}
|
||||||
dialect.Init(nil, engine.dialect.URI(), "", "")
|
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",
|
_, 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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue