-
Notifications
You must be signed in to change notification settings - Fork 57
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
Select a BINTEXT column with rows panic #50
Comments
Did make it work (v0.100.6), so that the example you shared is giving results. Anyway, need to provide some tests to be sure that the Bintext support is completely implemented. |
Tested v0.100.6 Inserting values when there are at least 2 lob columns insert (BLOB, TEXT, BINTEXT) and one is BINTEXT then this error is returned:
Example code: package main
import (
"bytes"
"database/sql"
"fmt"
"log"
"github.com/SAP/go-hdb/driver"
)
func main() {
// create dsn
dsn := fmt.Sprintf("hdb://%s:%s@%s:%d", "username", "password", "host", 39013)
// open db
db, err := sql.Open("hdb", dsn)
if err != nil {
log.Print(err)
return
}
err = db.Ping()
if err != nil {
log.Print(err)
return
}
defer db.Close()
// drop table if exists
db.Exec(`drop table issue50`)
// drop table at end for cleaning
defer db.Exec(`drop table issue50`)
// create the table
_, err = db.Exec(`create table issue50 (a BLOB, b BINTEXT)`)
if err != nil {
log.Print(err)
return
}
// select column types
rows, err := db.Query(`select * from issue50`)
if err != nil {
log.Print(err)
return
}
types, _ := rows.ColumnTypes()
for _, v := range types {
log.Printf("%s", v.DatabaseTypeName())
}
// begin transaction
tx, err := db.Begin()
stmt, err := tx.Prepare("insert into issue50 (a,b) values (?,?)")
if err != nil {
log.Print(err)
return
}
defer stmt.Close()
// create a lob reader for BLOB
lobBLOB := new(driver.Lob)
r := bytes.NewReader([]byte("0123456789"))
lobBLOB.SetReader(r)
// create a lob reader for BINTEXT
lobBINTEXT := new(driver.Lob)
r1 := bytes.NewReader([]byte("0123456789"))
lobBINTEXT.SetReader(r1)
_, err = stmt.Exec(lobBLOB, lobBINTEXT)
if err != nil {
log.Print(err)
return
}
// commit transaction
err = tx.Commit()
if err != nil {
log.Print(err)
return
}
// print success
log.Print("success")
} This should be another issue because this was completed, but I think you said this issue will be open while BINTEXT is in alpha. |
Thanks for testing!
Yes, that's fine - let's use this ticket until all issues with BINTEXT are ironed out. |
The example should work with v0.100.7 although full test of BINTEXT is not yet finalized. |
Works. For now the v0.100.7 works like expected in my tests. I will test all other new releases to check until BINTEXT is completed. Thanks. |
Thanks for your testing effort and confirming on the bug resolution. |
Tested v0.100.10. Works. |
Tested v0.102.2. Works. |
Using v0.100.5
Querying a column type
BINTEXT
panic the app.Connect to db and query rows:
Error:
A complete reproducible program is not possible because the driver cannot insert a value in BINTEXT column yet, see #41 (comment)
The text was updated successfully, but these errors were encountered: