Closed derit closed 6 years ago
Probably, it should be fixed with similar patch.
https://github.com/mattn/go-adodb/commit/329577bf18e68c091cfb6b29a43eeac2410c53be
this is urgent, because a difference data in db
Yes, I understand. But currently I do not have an environment to prepare MSSQL server. Please take me some time. If you try patch and will get fixes, please let me know.
okay, i wish the problem solved soon
I tried this but don't reproduce this.
package main
import (
"database/sql"
"log"
"time"
_ "github.com/mattn/go-adodb"
)
func main() {
db, err := sql.Open("adodb", `Driver={SQL Server};Server=XXXXX\SQLEXPRESS;Database=example`)
if err != nil {
log.Fatal(err)
}
rows, err := db.Query("SELECT GETDATE() AS tgl")
if err != nil {
log.Fatalf("select query err: %s/n", err)
}
for rows.Next() {
var dt time.Time
println(time.Now().Format("2006/01/02 15:04:05.000"))
rows.Scan(&dt)
println(dt.Format("2006/01/02 15:04:05.000"))
}
}
2018/10/06 14:34:17.769
2018/10/06 14:34:17.000
yes you get difference between date
real date in system
2018/10/06 14:34:17.769
after query
2018/10/06 14:34:17.000
milliseconds is difference
This is delay for rows.Scan(). I think this is a reasonable value. Your case seems to bee differ for four minutes.
2018-10-05 13:53:28 +0700 +07 2018-10-05 13:57:54.907 +0700 +07
Perhaps your SQL server have time legs.
Also you can try this PR. This fix nanoseconds differ. But won't fix your four minutes differ.
thanks, problem solved
i found a bug, time result not same in go-adodb and real datetime in db, i'm using mssql 2000,2012 and go1.9.1 windows/386
example query :
SELECT GETDATE() AS tgl
result :2018-10-05 13:57:54.907
code
result in go-adodb : 2018-10-05 13:53:28 +0700 +07
need result : 2018-10-05 13:57:54.907 +0700 +07