programatik29 / tokio-rusqlite

Asynchronous handle for rusqlite library.
MIT License
84 stars 20 forks source link

Explicitly closing a connection #7

Closed negative-ttl closed 1 year ago

negative-ttl commented 1 year ago

It seems that the only way to close a connection is to drop the the async handle. This will indeed close it but it may take time as that process happens on a different thread and we can never know when the file handle on the database is released. This is a problem on Windows.

call provides a &mut Connection so calling close on that doesn't work since Rusqlite's close must consume the connection.

It would be great if there was an explicit close method on the async handle that consumes the handle along with the connection and returns only when the closing process is over.

czocher commented 1 year ago

Hello @programatik29 I took a shot at solving this. Have a look at #12 and tell me what you think.