Merge: Benitlux & sqlite3: fix closing SQLite statements and malformed superstring
authorJean Privat <jean@pryen.org>
Thu, 14 Apr 2016 01:03:03 +0000 (21:03 -0400)
committerJean Privat <jean@pryen.org>
Thu, 14 Apr 2016 01:03:03 +0000 (21:03 -0400)
commita576282ff3bc1dad77fcfd302f3f51d5cb655cc4
tree85131383a078225923a3e579e71dac44affdd445
parentb94e8f361cd108e0f2ab259ef0e50f0aadc122a7
parent96d96e4d21b242924cbfdf924f6a5e90aba7eda1
Merge: Benitlux & sqlite3: fix closing SQLite statements and malformed superstring

Fix statements that were left open and did not remove the lock on the database. It now relies on iterators to close the statement after the end of the loop. This requires to actually complete the loop and not return before it is complete. A shortcut is to use `statement.iterator.to_a` when the result is expected to be short, like with a single row.

Note that I did not use `with` because it has the same problem with a `return` skipping the call to `finish`. Neither did I use `Finalizable` because it is invoked by the GC which may be much later.

Also fix one malformed superstring and improve the style of another one.

Pull-Request: #2009
Reviewed-by: Jean Privat <jean@pryen.org>