johnnadratowski / golang-neo4j-bolt-driver

Golang Bolt driver for Neo4j
MIT License
213 stars 72 forks source link

Fix bug where statement was not closed on a error with a query #58

Closed markuszm closed 6 years ago

markuszm commented 6 years ago

I discovered a bug when there is a error in a QueryNeo or QueryNeoAll call then the next query execution fails with "An open statement already exists". The reason is that the statement that is created in the queryNeo method is not closed on an error different to e.g. ExecNeo where the statement is closed because users of the method are not reusing the statement for later.

I created a test "TestBoltConn_CloseStatementOnError" to showcase the bug and fixed it by closing the statement in the error handling of queryNeo.

scott-wilson commented 6 years ago

It looks good to me, but I'll have to give it a proper review when I get back from vacation.