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

Memory error when using OLE object column #53

Open JensChrG opened 4 years ago

JensChrG commented 4 years ago

I get a panic when trying to read an OLE object from a DB.

The program fails the first time it calls rows.Next()

I have attached a database to work with the following code:

crash.zip

package main

import (
    "database/sql"
    "fmt"

    "github.com/go-ole/go-ole"
    _ "github.com/mattn/go-adodb"
)

func main() {
    ole.CoInitialize(0)
    defer ole.CoUninitialize()

    db, err := sql.Open("adodb", "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=crash.mdb;")
    if err != nil {
        fmt.Println("open", err)
        return
    }
    defer db.Close()

    rows, err := db.Query("select * from Table1")
    if err != nil {
        fmt.Println("select", err)
        return
    }
    defer rows.Close()

    for rows.Next() {
        // Will never get here
    }
}