Handle bools in MSSQL

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
Andrew Thornton 2021-04-12 12:43:19 +01:00
parent 4deb11051f
commit de0cf1c553
No known key found for this signature in database
GPG Key ID: 3CDE74631F13A748
1 changed files with 17 additions and 0 deletions

View File

@ -448,6 +448,21 @@ func formatColumnValue(dstDialect dialects.Dialect, d interface{}, col *schemas.
return "NULL"
}
if dstDialect.URI().DBType == schemas.SQLITE || dstDialect.URI().DBType == schemas.MSSQL {
if dq, ok := d.(bool); ok {
if dq {
return "1"
}
return "0"
}
if val, ok := d.(reflect.Value); ok && val.Kind() == reflect.Bool {
if val.Bool() {
return "1"
}
return "0"
}
}
if dq, ok := d.(bool); ok && (dstDialect.URI().DBType == schemas.SQLITE ||
dstDialect.URI().DBType == schemas.MSSQL) {
if dq {
@ -601,6 +616,8 @@ func (engine *Engine) dumpTables(tables []*schemas.Table, w io.Writer, tp ...sch
}
defer rows.Close()
fmt.Fprintf(os.Stdout, "%s: table.Type: %T\n", dstTableName, table.Type)
if table.Type != nil {
val := reflect.New(table.Type)
for rows.Next() {