mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 01:58:16 +00:00
bind/js: Add source attribute to Statement
This commit is contained in:
parent
376adbb10a
commit
f1018d97a4
1 changed files with 5 additions and 7 deletions
|
@ -80,12 +80,7 @@ impl Database {
|
|||
#[napi]
|
||||
pub fn prepare(&self, sql: String) -> napi::Result<Statement> {
|
||||
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<RefCell<limbo_core::Statement>>,
|
||||
}
|
||||
|
||||
#[napi]
|
||||
impl Statement {
|
||||
pub fn new(inner: RefCell<limbo_core::Statement>, database: Database) -> Self {
|
||||
pub fn new(inner: RefCell<limbo_core::Statement>, database: Database, source: String) -> Self {
|
||||
Self {
|
||||
inner: Rc::new(inner),
|
||||
database,
|
||||
source,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue