Moved cordova adapter to its own repository

This commit is contained in:
Ben Ashton 2021-03-02 20:14:46 -08:00
parent 1adcaa2e22
commit cd700f94ab
2 changed files with 0 additions and 58 deletions

View File

@ -1,27 +0,0 @@
import { PSQLAdapterError } from "./psql_adapter_error.mjs";
import { log } from "../../log.mjs";
export const PSQLAdapter = {
open: (dbName) => new Promise((resolve, reject) => {
cordova.exec(resolve, (e) => {
reject(new PSQLAdapterError(e));
}, "PawSQLite", "open", [dbName]);
}),
close: (dbName) => new Promise((resolve, reject) => {
cordova.exec(resolve, (e) => {
reject(new PSQLAdapterError(e));
}, "PawSQLite", "close", [dbName]);
}),
sql: (dbName, sql, ...args) => new Promise((resolve, reject) => {
log(sql);
cordova.exec(resolve, (e) => {
reject(new PSQLAdapterError(e));
}, "PawSQLite", "sql", [dbName, sql, ...args]);
}),
delete: (dbName) => new Promise((resolve, reject) => {
cordova.exec(resolve, (e) => {
reject(new PSQLAdapterError(e));
}, "PawSQLite", "delete", [dbName]);
})
};

View File

@ -1,31 +0,0 @@
import { PawSQLiteError } from "../../pawsqlite_error.mjs";
export class PSQLAdapterError extends PawSQLiteError {
constructor(response) {
if (response.hasOwnProperty("message")) {
super(response.message);
} else {
super();
}
if (response.hasOwnProperty("name")) {
this.name = response.name;
} else {
this.name = "PSQLAdapterError";
}
if (response.hasOwnProperty("trace")) {
this.trace = response.trace;
}
}
toString() {
let str = this.name;
if (this.hasOwnProperty("message")) {
str += ": " + this.message;
}
if (this.hasOwnProperty("trace")) {
str += "\n" + this.trace;
}
return str;
}
}