forked from mirror/go-sqlite3
column types text, varchar, *char return as strings:
As opposed to []byte arrays. This brings sqlite closer in line with other dbs like postgres, allowing downstream consumers to assume the scanned value is string across underlying dbs.
This commit is contained in:
parent
3fa1c550ff
commit
abc8991d4d
|
@ -223,6 +223,7 @@ var SQLiteTimestampFormats = []string{
|
||||||
const (
|
const (
|
||||||
columnDate string = "date"
|
columnDate string = "date"
|
||||||
columnDatetime string = "datetime"
|
columnDatetime string = "datetime"
|
||||||
|
columnText string = "text"
|
||||||
columnTimestamp string = "timestamp"
|
columnTimestamp string = "timestamp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -2061,10 +2062,15 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
|
||||||
t = t.In(rc.s.c.loc)
|
t = t.In(rc.s.c.loc)
|
||||||
}
|
}
|
||||||
dest[i] = t
|
dest[i] = t
|
||||||
|
case columnText:
|
||||||
|
dest[i] = s
|
||||||
default:
|
default:
|
||||||
|
if strings.Contains(strings.ToLower(rc.decltype[i]), "char") {
|
||||||
|
dest[i] = s
|
||||||
|
} else {
|
||||||
dest[i] = []byte(s)
|
dest[i] = []byte(s)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue