Skip to content

Commit

Permalink
crates/core: add is_autocommit
Browse files Browse the repository at this point in the history
  • Loading branch information
psarna committed Jul 27, 2023
1 parent d4ee2e9 commit e1f7218
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/bindings/c/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ mod errors;
mod types;

use types::{
libsql_connection, libsql_connection_t, libsql_database, libsql_database_t,
libsql_rows_future, libsql_rows_future_t, libsql_rows_t,
libsql_connection, libsql_connection_t, libsql_database, libsql_database_t, libsql_rows_future,
libsql_rows_future_t, libsql_rows_t,
};

#[no_mangle]
Expand Down
5 changes: 3 additions & 2 deletions crates/bindings/wasm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use wasm_bindgen::prelude::*;


#[wasm_bindgen]
pub struct Database {
inner: libsql::Database,
Expand All @@ -10,7 +9,9 @@ pub struct Database {
impl Database {
#[wasm_bindgen(constructor)]
pub fn new() -> Database {
Database { inner: libsql::Database::open(":memory:").unwrap() }
Database {
inner: libsql::Database::open(":memory:").unwrap(),
}
}

pub fn all(&self, _sql: String, f: &js_sys::Function) {
Expand Down
4 changes: 4 additions & 0 deletions crates/core/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ impl Connection {
params: params.into(),
}
}

pub fn is_autocommit(&self) -> bool {
self.raw.is_autocommit()
}
}

// Automatically drop all dangling statements when the connection is dropped.
Expand Down

0 comments on commit e1f7218

Please sign in to comment.