@joystick.js/node-canary 0.0.0-canary.311 → 0.0.0-canary.313
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.
|
@@ -22,7 +22,8 @@ var generate_sql_from_object_default = {
|
|
|
22
22
|
return {
|
|
23
23
|
statement: `SELECT ${column_names} FROM ${options?.table} ${options?.where ? `WHERE ${where}` : ""}`,
|
|
24
24
|
column_names,
|
|
25
|
-
where
|
|
25
|
+
where,
|
|
26
|
+
values: Object.values(options?.where)
|
|
26
27
|
};
|
|
27
28
|
},
|
|
28
29
|
insert: (options = {}) => {
|
|
@@ -31,20 +31,20 @@ var postgresql_default = async (settings = {}, databasePort = 2610) => {
|
|
|
31
31
|
const pool = new Pool(connection_config);
|
|
32
32
|
return {
|
|
33
33
|
pool,
|
|
34
|
-
query: (...
|
|
35
|
-
return pool.query(...
|
|
34
|
+
query: (...args) => {
|
|
35
|
+
return pool.query(...args).then((response) => {
|
|
36
36
|
return response?.rows || [];
|
|
37
37
|
}).catch((error) => {
|
|
38
38
|
console.log(chalk.redBright(`
|
|
39
39
|
Failed SQL Statement:
|
|
40
40
|
`));
|
|
41
|
-
console.log(
|
|
41
|
+
console.log(args[0]);
|
|
42
42
|
console.log(`
|
|
43
43
|
`);
|
|
44
44
|
console.log(chalk.redBright(`
|
|
45
45
|
Failed Values:
|
|
46
46
|
`));
|
|
47
|
-
console.log(
|
|
47
|
+
console.log(args[1]);
|
|
48
48
|
throw error;
|
|
49
49
|
});
|
|
50
50
|
},
|
|
@@ -56,13 +56,7 @@ Failed Values:
|
|
|
56
56
|
console.log(chalk.redBright(`
|
|
57
57
|
Failed SQL Statement:
|
|
58
58
|
`));
|
|
59
|
-
console.log(
|
|
60
|
-
console.log(`
|
|
61
|
-
`);
|
|
62
|
-
console.log(chalk.redBright(`
|
|
63
|
-
Failed Values:
|
|
64
|
-
`));
|
|
65
|
-
console.log(args[1]);
|
|
59
|
+
console.log(column.statement);
|
|
66
60
|
throw error;
|
|
67
61
|
});
|
|
68
62
|
},
|
|
@@ -74,13 +68,7 @@ Failed Values:
|
|
|
74
68
|
console.log(chalk.redBright(`
|
|
75
69
|
Failed SQL Statement:
|
|
76
70
|
`));
|
|
77
|
-
console.log(
|
|
78
|
-
console.log(`
|
|
79
|
-
`);
|
|
80
|
-
console.log(chalk.redBright(`
|
|
81
|
-
Failed Values:
|
|
82
|
-
`));
|
|
83
|
-
console.log(args[1]);
|
|
71
|
+
console.log(table.statement);
|
|
84
72
|
throw error;
|
|
85
73
|
});
|
|
86
74
|
},
|
|
@@ -92,31 +80,31 @@ Failed Values:
|
|
|
92
80
|
console.log(chalk.redBright(`
|
|
93
81
|
Failed SQL Statement:
|
|
94
82
|
`));
|
|
95
|
-
console.log(
|
|
83
|
+
console.log(insert.statement);
|
|
96
84
|
console.log(`
|
|
97
85
|
`);
|
|
98
86
|
console.log(chalk.redBright(`
|
|
99
87
|
Failed Values:
|
|
100
88
|
`));
|
|
101
|
-
console.log(
|
|
89
|
+
console.log(insert.values);
|
|
102
90
|
throw error;
|
|
103
91
|
});
|
|
104
92
|
},
|
|
105
93
|
select: (options = {}) => {
|
|
106
94
|
const select = generate_sql_from_object.select(options);
|
|
107
|
-
return pool.query(select.statement, select.
|
|
95
|
+
return pool.query(select.statement, select.values).then((response) => {
|
|
108
96
|
return response?.rows || [];
|
|
109
97
|
}).catch((error) => {
|
|
110
98
|
console.log(chalk.redBright(`
|
|
111
99
|
Failed SQL Statement:
|
|
112
100
|
`));
|
|
113
|
-
console.log(
|
|
101
|
+
console.log(select.statement);
|
|
114
102
|
console.log(`
|
|
115
103
|
`);
|
|
116
104
|
console.log(chalk.redBright(`
|
|
117
105
|
Failed Values:
|
|
118
106
|
`));
|
|
119
|
-
console.log(
|
|
107
|
+
console.log(select.where);
|
|
120
108
|
throw error;
|
|
121
109
|
});
|
|
122
110
|
},
|
|
@@ -128,13 +116,13 @@ Failed Values:
|
|
|
128
116
|
console.log(chalk.redBright(`
|
|
129
117
|
Failed SQL Statement:
|
|
130
118
|
`));
|
|
131
|
-
console.log(
|
|
119
|
+
console.log(update.statement);
|
|
132
120
|
console.log(`
|
|
133
121
|
`);
|
|
134
122
|
console.log(chalk.redBright(`
|
|
135
123
|
Failed Values:
|
|
136
124
|
`));
|
|
137
|
-
console.log(
|
|
125
|
+
console.log(update.values);
|
|
138
126
|
throw error;
|
|
139
127
|
});
|
|
140
128
|
}
|