nakagami / firebirdsql

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

DSQL problems #31

Closed everton-sales-branco closed 5 years ago

everton-sales-branco commented 8 years ago

Hi, There are some problems with DSQL statements like:

Insert into TableName (Name, Phone) values ("Everton", "123 123123") returning ID

nakagami commented 8 years ago

I think it works. https://github.com/nakagami/firebirdsql/blob/master/driver_test.go#L133

I want a test case ( or more precise sample code).

everton-sales-branco commented 8 years ago

I was using a global connection, but, it doesn't execute a "commit" when you use a Query() So I did something like this:

tx, err := globalConn.Begin()
if err != nil {
    panic(err.Error())
}
defer tx.Rollback()
stmt, err := tx.Prepare("INSERT INTO TABLE1 (XXX, YYY, ZZZ) VALUES (?, ?, ?) RETURNING ID")
if err != nil {
    panic(err.Error())
}
defer stmt.Close()
row := stmt.QueryRow(inputJSON.XXX, inputJSON.YYY, inputJSON.ZZZ).Scan(&inputJSON.ID) 
err = tx.Commit()
if err != nil {
    panic(err.Error())
}
nakagami commented 7 years ago

I hope I have fixed this issue at #35 . Is this issue fixed now ?

nakagami commented 5 years ago

Related to issue #76