@onurege3467/zerohelper 2.0.0 → 2.0.2
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/database/sqldb/index.js +0 -10
- package/package.json +1 -1
package/database/sqldb/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const path = require("path");
|
|
3
3
|
const sqlite3 = require("sqlite3").verbose();
|
|
4
|
-
var i = 0;
|
|
5
4
|
class Database {
|
|
6
5
|
constructor(dbFilePath) {
|
|
7
6
|
this.dbFilePath = dbFilePath || path.join(__dirname, "database.sqlite");
|
|
@@ -24,7 +23,6 @@ class Database {
|
|
|
24
23
|
)
|
|
25
24
|
.then(() => {
|
|
26
25
|
console.log("Table initialized");
|
|
27
|
-
i = 1;
|
|
28
26
|
})
|
|
29
27
|
.catch((err) => console.error(err));
|
|
30
28
|
}
|
|
@@ -83,10 +81,6 @@ class Database {
|
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
runQuery(query, params = []) {
|
|
86
|
-
if (!i) {
|
|
87
|
-
console.log("Database not initialized");
|
|
88
|
-
return Promise.reject(new Error("Database not initialized"));
|
|
89
|
-
}
|
|
90
84
|
return new Promise((resolve, reject) => {
|
|
91
85
|
this.db.run(query, params, function (err) {
|
|
92
86
|
if (err) {
|
|
@@ -99,10 +93,6 @@ class Database {
|
|
|
99
93
|
}
|
|
100
94
|
|
|
101
95
|
getQuery(query, params = []) {
|
|
102
|
-
if (!i) {
|
|
103
|
-
console.log("Database not initialized");
|
|
104
|
-
return Promise.reject(new Error("Database not initialized"));
|
|
105
|
-
}
|
|
106
96
|
return new Promise((resolve, reject) => {
|
|
107
97
|
this.db.get(query, params, (err, row) => {
|
|
108
98
|
if (err) {
|