go-xorm / xorm

Simple and Powerful ORM for Go, support mysql,postgres,tidb,sqlite3,mssql,oracle, Moved to https://gitea.com/xorm/xorm
BSD 3-Clause "New" or "Revised" License
6.67k stars 754 forks source link

xorm对mssql的日期类型(datetime, datetime2..)兼容不是很好 #134

Open wulove opened 10 years ago

wulove commented 10 years ago

对github.com/lunny/godbc进行了测试,发现对datetime,datetime2兼容的不是很好(进行插入操作会丢失纳秒值),这主要还是因为godbc不兼容datetime,datetime2;

于是我又拿了github.com/denisenkom/go-mssqldb这个mssql库(本身很好的支持了date, datetime, datetime2, datetimeoffset)能很好的将golang中的time值转为mssql中的datetime, datetime2,不会丢失纳秒值; 于是我在xorm.go文件中增加了一行: "mssql": {"mssql", func() core.Driver { return &odbcDriver{} }, func() core.Dialect { return &mssql{} }}, 然后就开始测试,发现xorm对datetime, datetime2插表时还是会丢失纳秒值,希望能对其支持

linquize commented 9 years ago

How to use datetimeoffset (i.e. timezone)

lunny commented 9 years ago

Sorry, I have no mssql development environment. So I can't test the datetimeoffset's problem.

linquize commented 9 years ago

Do you have sqlite, mysql and postgresql to test with?