jorgerojas26 / lazysql

A cross-platform TUI database management tool written in Go.
MIT License
916 stars 51 forks source link

fix: error handing for row cursors #100

Closed prochac closed 1 month ago

prochac commented 2 months ago

(*sql.Rows).Next() can return false due to an error. The error must be handled by checking (*sql.Rows).Err().

The transaction must be ended by commit or rollback to close the db connection. Calling rollback after commit is noop.

Don't call a query in the middle of cursor, as it may lead to a deadlock. The inner query may wait for a free connection, and the connection from the cursor can't be freed because it's stuck by the inner query waiting.

jorgerojas26 commented 2 months ago

Oh, that's a good catch there ! Thank you!

I think @ccoVeille is right, all the errors are not being handled.

jorgerojas26 commented 2 months ago

Is this PR ready to be merged?