mattn / go-adodb

Microsoft ActiveX Object DataBase driver for go that using exp/sql
http://mattn.kaoriya.net/
MIT License
142 stars 36 forks source link

DateTime Fields Always return "2118-03-XX XX:XX:XX.XXXXXXXXXXXX UTC" #13

Closed csntgao closed 11 years ago

csntgao commented 11 years ago

The code is as following:

============================
for rows.Next() {
        var date time.Time
        rows.Scan(&date)
        fmt.Println(date)
    }
============================

The Result is as followiing:

2118-03-04 04:28:28.545076635 +0000 UTC

2118-03-04 04:28:28.381231586 +0000 UTC

2118-03-04 04:28:27.996275258 +0000 UTC

2118-03-04 04:28:27.826067295 +0000 UTC

2118-03-04 04:28:27.340895064 +0000 UTC

2118-03-04 04:28:27.242269889 +0000 UTC

2118-03-04 04:28:27.041838082 +0000 UTC

2118-03-04 04:28:26.865267204 +0000 UTC

2118-03-04 04:28:26.209887009 +0000 UTC

2118-03-04 04:28:25.976049901 +0000 UTC

But in fact ,the Datas in My Database(MSQL2000 or MSSQL2008) are :

2011-02-14 21:25:46.000
2011-02-14 21:24:03.000
2011-02-14 21:20:01.000
2011-02-14 21:18:14.000
2011-02-14 21:13:09.000
2011-02-14 21:12:07.000
2011-02-14 21:10:01.000
2011-02-14 21:08:10.000
2011-02-14 21:01:18.000
2011-02-14 20:58:51.000

Would Please tell me WHY? or What should I do to correct the errors? Thank You.

mattn commented 11 years ago

@andybalholm Can you handle this issue?

csntgao commented 11 years ago

I'm Waiting and waiting while the flowers have WILTED!

andybalholm commented 11 years ago

Does this patch work?

diff --git a/adodb.go b/adodb.go index 6727f25..bef8453 100644 --- a/adodb.go +++ b/adodb.go @@ -357,11 +357,16 @@ func (rc *AdodbRows) Next(dest []driver.Value) error { case 132: // ADUSERDEFINED dest[i] = uintptr(val.Val) case 133: // ADDBDATE

csntgao commented 11 years ago

It's Right,thank andybalholm!

mattn commented 11 years ago

Ok, I'll include it.