cleanup code

This commit is contained in:
Yasuhiro Matsumoto 2015-03-04 22:58:32 +09:00
parent 4c5c4e5261
commit 18aa166fa9
1 changed files with 8 additions and 13 deletions

View File

@ -572,21 +572,16 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
switch rc.decltype[i] {
case "timestamp", "datetime", "date":
if rc.s.c.loc != nil {
zone := rc.s.c.loc
if zone == nil {
zone = time.UTC
}
for _, format := range SQLiteTimestampFormats {
if timeVal, err = time.ParseInLocation(format, s, rc.s.c.loc); err == nil {
if timeVal, err = time.ParseInLocation(format, s, zone); err == nil {
dest[i] = timeVal
break
}
}
} else {
for _, format := range SQLiteTimestampFormats {
if timeVal, err = time.ParseInLocation(format, s, time.UTC); err == nil {
dest[i] = timeVal
break
}
}
}
if err != nil {
// The column is a time value, so return the zero time on parse failure.
dest[i] = time.Time{}