You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
940 B
40 lines
940 B
import { NodeAdapterError } from "./node_adapter_error.mjs"; |
|
import { enableDebug, log } from "./log.mjs"; |
|
|
|
const databases = new Map(); |
|
|
|
export default { |
|
name: "PawSQLiteNodeAdapter", |
|
open: async (dbName) => { |
|
// const version = "1.0"; |
|
|
|
// if (!databases.has(dbName)) { |
|
// databases.set(dbName, new DatabaseWrapper(dbName, version)); |
|
// } |
|
|
|
// return ResponseWrapper.success({ version }); |
|
}, |
|
|
|
close: async (dbName) => { |
|
// databases.delete(dbName); |
|
// return ResponseWrapper.success(); |
|
}, |
|
|
|
sql: async (dbName, sql, ...args) => { |
|
// log(sql); |
|
|
|
// const db = databases.get(dbName); |
|
// if (!db) { |
|
// throw new NodeAdapterError("Database not open"); |
|
// } |
|
|
|
// const result = await db.sql(sql, ...args); |
|
// return ResponseWrapper.success(result); |
|
}, |
|
|
|
delete: async (dbName) => { |
|
// throw new NodeAdapterError("Delete not implemented"); |
|
}, |
|
|
|
debug: enableDebug |
|
};
|
|
|