diff --git a/bindings/javascript/src/lib.rs b/bindings/javascript/src/lib.rs index 1381c4c46..5c42aebcc 100644 --- a/bindings/javascript/src/lib.rs +++ b/bindings/javascript/src/lib.rs @@ -80,12 +80,7 @@ impl Database { #[napi] pub fn prepare(&self, sql: String) -> napi::Result { let stmt = self.conn.prepare(&sql).map_err(into_napi_error)?; - Ok(Statement::new(RefCell::new(stmt), self.clone())) - } - - #[napi] - pub fn transaction(&self) { - todo!() + Ok(Statement::new(RefCell::new(stmt), self.clone(), sql)) } #[napi] @@ -144,16 +139,19 @@ pub struct Statement { // pub readonly: bool, // #[napi(writable = false)] // pub busy: bool, + #[napi(writable = false)] + pub source: String, database: Database, inner: Rc>, } #[napi] impl Statement { - pub fn new(inner: RefCell, database: Database) -> Self { + pub fn new(inner: RefCell, database: Database, source: String) -> Self { Self { inner: Rc::new(inner), database, + source, } }