Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot have last column as date #36

Closed
japettyjohn opened this issue Aug 15, 2014 · 5 comments
Closed

Cannot have last column as date #36

japettyjohn opened this issue Aug 15, 2014 · 5 comments

Comments

@japettyjohn
Copy link

When doing a select where the last column is a date type the value is an empty slice and results in an index out of bounds error when parsing the value into a date on line 777 of oci8.go.

@mattn
Copy link
Owner

mattn commented Aug 18, 2014

Sorry, I don't understand well. Could you please give me the patch?

@ricsmania
Copy link
Contributor

Hi mattn,

Got this same problem. The code below reproduces the error. For it to happen the query must return at least 9 fields, the last one being a date. So:
"select 1,2,3, sysdate from dual" - works
"select 1,2,3,4,5,6,7,8, sysdate from dual" - doesn't work
"select 1,2,3,4,5,6,7,8, sysdate, 11 from dual" - works

I tried debugging it but so far I can't figure it out.

Thanks!

package main

import (
    "database/sql"
    "fmt"
    _ "github.com/mattn/go-oci8"
)

func main() {
    db, err := sql.Open("oci8", "system/manager@localhost:1521/orcl")
    if err != nil {
        fmt.Println(err)
    }
    defer db.Close()
    rows, err := db.Query("select 1,2,3,4,5,6,7,8, sysdate from dual")
    if err != nil {
        fmt.Println(err)
    }
    for rows.Next() {
        fmt.Println("got row")
    }
}

@mattn
Copy link
Owner

mattn commented Sep 3, 2014

@RicardoSmania Thanks. But I can't reproduce it.

@mattn
Copy link
Owner

mattn commented Jan 28, 2015

Should be fixed.

@mattn mattn closed this as completed Jan 28, 2015
@ricsmania
Copy link
Contributor

Hi @mattn, it is fixed for me. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants