go-gorm / sqlserver

GORM sqlserver driver
MIT License
55 stars 37 forks source link

sqlserver #57

Closed KeenSting0712 closed 1 year ago

KeenSting0712 commented 2 years ago

can this gentool support sqlserver 2008 ?

when i try to generate the model from sqlserve 2008, i got error msg like this :

2022/03/23 21:04:26 /Users/keenliang/go/pkg/mod/gorm.io/driver/sqlserver@v1.3.1/migrator.go:153 mssql: Invalid usage of the option NEXT in the FETCH statement. [27.141ms] [rows:-] SELECT * FROM "LawCase" ORDER BY (SELECT NULL) OFFSET 0 ROW FETCH NEXT 1 ROWS ONLY

2022/03/23 21:04:26 /Users/keenliang/go/pkg/mod/gorm.io/gen@v0.2.43/generator.go:137 [error] generate struct from table fail: mssql: Invalid usage of the option NEXT in the FETCH statement. 2022-03-23 21:04:26.057 ERROR recovery@v0.1.2/recovery.go:42 [PANIC]generate struct fail goroutine 264 [running]: git.code.oa.com/trpc-go/trpc-filter/recovery.glob..func1({0x101a763c8, 0x14002b6ede0}, {0x10186a660, 0x101a4ac30}) /Users/keenliang/go/pkg/mod/git.code.oa.com/trpc-go/trpc-filter/recovery@v0.1.2/recovery.go:41 +0x6c git.code.oa.com/trpc-go/trpc-filter/recovery.ServerFilter.func1.1(0x102325570, {0x101a763c8, 0x14002b6ede0}, 0x14002ca3250) /Users/keenliang/go/pkg/mod/git.code.oa.com/trpc-go/trpc-filter/recovery@v0.1.2/recovery.go:60 +0x64 panic({0x10186a660, 0x101a4ac30}) /Users/keenliang/sdk/go1.17.6/src/runtime/panic.go:1038 +0x21c gorm.io/gen.(Generator).GenerateModelAs(0x140005dc460, {0x10156d14a, 0x7}, {0x140032243f8, 0x7}, {0x0, 0x0, 0x0}) /Users/keenliang/go/pkg/mod/gorm.io/gen@v0.2.43/generator.go:138 +0x3ec gorm.io/gen.(Generator).GenerateModel(0x140005dc460, {0x10156d14a, 0x7}, {0x0, 0x0, 0x0}) /Users/keenliang/go/pkg/mod/gorm.io/gen@v0.2.43/generator.go:103 +0x80

and for now, xorm can generate models from sqlserver 2008 perfectly, hope grom/gen could make it as well, best wish

The document you expected this should be explained

Expected answer

tr1v3r commented 2 years ago

sorry, the error is threw by driver of sqlsever which support version 2012+ for now

jinzhu commented 1 year ago

sorry, but 2008 is not going to be supported.