-
Notifications
You must be signed in to change notification settings - Fork 60
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
Got a "driver: bad connection" error on db.conn.Close() due to previos EOF error on stmt.Query() #169
Comments
After further investigation, this seems related to an EOF error obtained on second execution of prepared stmt.Query()
BTW: I'm connecting to the latest FB5 ... |
tested on FB 2.5.9 ... same EOF error :-( |
The first time stmt.Query() is executed, the driver processing is performed inside sql.Open() and conn.Prepare() for the first time. Are there wrong connection parameters or SQL statements? |
I think there is no error on parameters or statements, I have updated the test and I obtain this output:
Here is the table DDL and DML, in case you want to run the test yourself:
|
I have isolated the firebird testing in a sigle file so you can run them easily ... |
Thank you. For example, the following modification is not able to gracefull clean up the error and transaction is roll backed automaically.
So I cannot find a good solution. |
When I have time, I will find out if there is a solution. |
I have just found a workaround/clue for this error: you can do a second call to stmt.Query() after rows.Close() just to clear the error ... here is the modified (passing) test:
|
thanks |
Internally, the modification was such that the statement was reworked. This is unfortunate, because it would make the use of Prepare() meaningless, but I prioritized fixing the problem without breaking the current behavior. If anyone has a fix that uses transactions and statements more efficiently, I'd be glad to hear it. |
Is this a normal behaviour?
The text was updated successfully, but these errors were encountered: