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

Possible incombatibility with current go-ole #21

Closed dtrehas closed 6 years ago

dtrehas commented 8 years ago

Thank you for your project. It is the first time I tried to code in Go.

I observed initially in adodb.go that was a reference "github.com/mattn/go-ole" and I changed the import to to github.com/go-ole/go-ole because of many compiling errors with your github.com/mattn/go-ole[/oleutils etc etc]

But then I had is

c:/prog/go/bin/go.exe build -i [C:/Prog/GOPATH/src/github.com/mattn/go-adodb]

github.com/mattn/go-adodb

.\adodb.go:355: invalid slice index sa.Bounds (type [16]byte) .\adodb.go:391: invalid slice index sa.Bounds (type [16]byte) Error: process exited with code 2.

It was mentioning the line dest[i] = (*[1 << 30]byte)(unsafe.Pointer(uintptr(sa.Data)))[0:sa.Bounds.Elements] ^

I had a look into the safearray.go and I saw //////////////////////////////////////////////////////// // Package is meant to retrieve and process safe array data returned from COM.

package ole

// SafeArrayBound defines the SafeArray boundaries. type SafeArrayBound struct { Elements uint32 LowerBound int32 }

// SafeArray is how COM handles arrays. type SafeArray struct { Dimensions uint16 FeaturesFlag uint16 ElementsSize uint32 LocksAmount uint32 Data uint32 Bounds [16]byte }

// SAFEARRAY is obsolete, exists for backwards compatibility. // Use SafeArray type SAFEARRAY SafeArray

// SAFEARRAYBOUND is obsolete, exists for backwards compatibility. // Use SafeArrayBound type SAFEARRAYBOUND SafeArrayBound


Bounds was a byte array but not a struct to have an element as a member of it.

Excuse my COM and GO ignorance. Can you help with this?

Thank you for your very good job, MattN!

mattn commented 8 years ago

Fixed.