Handle bools in MSSQL
Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
4deb11051f
commit
de0cf1c553
17
engine.go
17
engine.go
|
@ -448,6 +448,21 @@ func formatColumnValue(dstDialect dialects.Dialect, d interface{}, col *schemas.
|
||||||
return "NULL"
|
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 ||
|
if dq, ok := d.(bool); ok && (dstDialect.URI().DBType == schemas.SQLITE ||
|
||||||
dstDialect.URI().DBType == schemas.MSSQL) {
|
dstDialect.URI().DBType == schemas.MSSQL) {
|
||||||
if dq {
|
if dq {
|
||||||
|
@ -601,6 +616,8 @@ func (engine *Engine) dumpTables(tables []*schemas.Table, w io.Writer, tp ...sch
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
|
fmt.Fprintf(os.Stdout, "%s: table.Type: %T\n", dstTableName, table.Type)
|
||||||
|
|
||||||
if table.Type != nil {
|
if table.Type != nil {
|
||||||
val := reflect.New(table.Type)
|
val := reflect.New(table.Type)
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
|
|
Loading…
Reference in New Issue