nakagami / firebirdsql

Firebird RDBMS sql driver for Go (golang)
MIT License
227 stars 60 forks source link

Error inserting blob #53

Closed ghost closed 6 years ago

ghost commented 6 years ago

If I try to insert a huge string the database freezes. It won't give any error, but the connection to the database gets kind of "bugged". This is not happening in python with firebird, just in GO. It's not related to GO cuz I can insert the same string in a PostgreSQL database using GO. So, It's related to the firebird driver ...

I can select a string of the same size and put it onto a var and print it (that works). The problem is just on insert/update... Example:

func HugeBlobTest() { sqlCreate := CREATE TABLE BlobTest ( id INTEGER generated by default as identity primary key, bugField blob sub_type text ) _, err := dbconfig.DBConn.Exec(sqlCreate) if err != nil { fmt.Println(err) }

tx, err := dbconfig.DBConn.Begin()

var hugeBlob bytes.Buffer
for i:= 0; i < 671633; i ++ { // if you change to 670000, it works
    hugeBlob.WriteString("F")
}

if err != nil { fmt.Println(err) } sqlTest1 := insert into BlobTest(bugField) values(?) _, err = tx.Exec(sqlTest1, hugeBlob.String()) if err != nil { fmt.Println("Test: ", err) } else { fmt.Println("Test: OK") } tx.Commit() }

Thanks.

arteev commented 6 years ago

I also have this problem.

nakagami commented 6 years ago

Sorry @giovannigaspar , But I think it has fixed by @arteev now.