mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-05 09:14:24 +01:00
bindings/javascript: Fix Database.close()
We need to drop reference to `turso_core::Database` for this to work.
This commit is contained in:
@@ -65,7 +65,7 @@ pub struct Database {
|
||||
pub open: bool,
|
||||
#[napi(writable = false)]
|
||||
pub name: String,
|
||||
_db: Arc<turso_core::Database>,
|
||||
db: Option<Arc<turso_core::Database>>,
|
||||
conn: Arc<turso_core::Connection>,
|
||||
_io: Arc<dyn turso_core::IO>,
|
||||
}
|
||||
@@ -108,7 +108,7 @@ impl Database {
|
||||
Ok(Self {
|
||||
readonly: opts.readonly(),
|
||||
memory,
|
||||
_db: db,
|
||||
db: Some(db),
|
||||
conn,
|
||||
open: true,
|
||||
name: path,
|
||||
@@ -237,6 +237,7 @@ impl Database {
|
||||
pub fn close(&mut self) -> napi::Result<()> {
|
||||
if self.open {
|
||||
self.conn.close().map_err(into_napi_error)?;
|
||||
self.db.take();
|
||||
self.open = false;
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user