Fix dump
This commit is contained in:
parent
4f6dd437c4
commit
25b3513489
|
@ -836,8 +836,8 @@ func (db *dameng) GetColumns(queryer core.Queryer, ctx context.Context, tableNam
|
|||
col.Indexes = make(map[string]int)
|
||||
|
||||
var colDefault dmClobScanner
|
||||
var colName, nullable, dataType, dataPrecision, dataScale, comment sql.NullString
|
||||
var dataLen sql.NullInt64
|
||||
var colName, nullable, dataType, dataPrecision, comment sql.NullString
|
||||
var dataScale, dataLen sql.NullInt64
|
||||
|
||||
err = rows.Scan(&colName, &colDefault, &dataType, &dataLen, &dataPrecision,
|
||||
&dataScale, &nullable, &comment)
|
||||
|
@ -923,7 +923,11 @@ func (db *dameng) GetColumns(queryer core.Queryer, ctx context.Context, tableNam
|
|||
return nil, nil, fmt.Errorf("unknown colType %v %v", dataType.String, col.SQLType)
|
||||
}
|
||||
|
||||
if col.SQLType.Name == "TIMESTAMP" {
|
||||
col.Length = int(dataScale.Int64)
|
||||
} else {
|
||||
col.Length = int(dataLen.Int64)
|
||||
}
|
||||
|
||||
if col.SQLType.IsText() || col.SQLType.IsTime() {
|
||||
if !col.DefaultIsEmpty {
|
||||
|
|
|
@ -588,6 +588,11 @@ func (engine *Engine) dumpTables(ctx context.Context, tables []*schemas.Table, w
|
|||
if _, err = io.WriteString(w, formatBool(s.String, dstDialect)); err != nil {
|
||||
return err
|
||||
}
|
||||
} else if sess.engine.dialect.URI().DBType == schemas.DAMENG && stp.IsTime() && len(s.String) == 25 {
|
||||
r := strings.Replace(s.String[:19], "T", " ", -1)
|
||||
if _, err = io.WriteString(w, "'"+r+"'"); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if _, err = io.WriteString(w, "'"+strings.ReplaceAll(s.String, "'", "''")+"'"); err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue