mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-05 01:04:22 +01:00
Implement .database property
This commit is contained in:
@@ -32,7 +32,7 @@ class Database {
|
||||
*/
|
||||
prepare(sql) {
|
||||
try {
|
||||
return new Statement(this.db.prepare(sql));
|
||||
return new Statement(this.db.prepare(sql), this);
|
||||
} catch (err) {
|
||||
throw convertError(err);
|
||||
}
|
||||
@@ -148,8 +148,9 @@ class Database {
|
||||
* Statement represents a prepared SQL statement that can be executed.
|
||||
*/
|
||||
class Statement {
|
||||
constructor(stmt) {
|
||||
constructor(stmt, database) {
|
||||
this.stmt = stmt;
|
||||
this.db = database;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,6 +177,10 @@ class Statement {
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
||||
get database() {
|
||||
return this.db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the SQL statement and returns an info object.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user