velocious 1.0.12 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -24,29 +24,13 @@ export default class VelociousDatabaseDriversSqliteNode extends Base {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
localStorageName = () => `VelociousDatabaseDriversSqlite---${digg(this.getArgs(), "name")}`
|
|
27
|
-
disconnect = () => this.saveDatabase()
|
|
28
|
-
saveDatabase = async () => {
|
|
29
|
-
const localStorageContent = this.connection.export()
|
|
30
|
-
await this.betterLocaleStorage.set(this.localStorageName(), localStorageContent)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
saveDatabaseDebounce = debounce(this.saveDatabase, 500)
|
|
34
27
|
|
|
35
28
|
async close() {
|
|
36
|
-
await this.
|
|
37
|
-
await this.connection.end()
|
|
29
|
+
await this.connection.close()
|
|
38
30
|
this.connection = undefined
|
|
39
31
|
}
|
|
40
32
|
|
|
41
33
|
query = async (sql) => {
|
|
42
|
-
|
|
43
|
-
const downcasedSQL = sql.toLowerCase().trim()
|
|
44
|
-
|
|
45
|
-
// Auto-save database in local storage in case we can find manipulating instructions in the SQL
|
|
46
|
-
if (downcasedSQL.startsWith("delete ") || downcasedSQL.startsWith("insert into ") || downcasedSQL.startsWith("update ")) {
|
|
47
|
-
this.saveDatabaseDebounce()
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return result
|
|
34
|
+
return await query(this.connection, sql)
|
|
51
35
|
}
|
|
52
36
|
}
|