@bdkinc/knex-ibmi 0.0.31 → 0.0.33
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/README.md +1 -0
- package/dist/index.js +5 -3
- package/package.json +1 -1
- package/src/index.ts +9 -5
- package/src/query/ibmi-querycompiler.ts +0 -16
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -323,14 +323,12 @@ var IBMiQueryCompiler = class extends import_querycompiler.default {
|
|
|
323
323
|
this.tableName} where ${Object.entries(this.single.update).map(([key, value]) => `"${key}" = '${value}'`).join(" and ")}${moreWheres.length > 0 && " and "}${moreWheres.join(
|
|
324
324
|
" and "
|
|
325
325
|
)}` : "";
|
|
326
|
-
console.log({ selectReturning });
|
|
327
326
|
const sql = withSQL + // @ts-ignore
|
|
328
327
|
`update ${this.single.only ? "only " : ""}${this.tableName} set ` + // @ts-ignore
|
|
329
328
|
updates.join(", ") + (where ? ` ${where}` : "") + (order ? ` ${order}` : "") + (limit ? ` ${limit}` : "");
|
|
330
329
|
return { sql, returning, selectReturning };
|
|
331
330
|
}
|
|
332
331
|
_returning(method, value, withTrigger) {
|
|
333
|
-
console.log("_returning", value);
|
|
334
332
|
switch (method) {
|
|
335
333
|
case "update":
|
|
336
334
|
case "insert":
|
|
@@ -494,7 +492,11 @@ var DB2Client = class extends import_knex.knex.Client {
|
|
|
494
492
|
await connection.commit();
|
|
495
493
|
}
|
|
496
494
|
}
|
|
497
|
-
console2.log(
|
|
495
|
+
console2.log(
|
|
496
|
+
"knex-ibmi: ",
|
|
497
|
+
obj.sql,
|
|
498
|
+
obj.bindings ? JSON.stringify(obj.bindings) : ""
|
|
499
|
+
);
|
|
498
500
|
return obj;
|
|
499
501
|
}
|
|
500
502
|
transaction(container, config, outerTx) {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -60,7 +60,7 @@ class DB2Client extends knex.Client {
|
|
|
60
60
|
async acquireRawConnection() {
|
|
61
61
|
this.printDebug("acquiring raw connection");
|
|
62
62
|
const connectionConfig = this.config.connection;
|
|
63
|
-
console.log(this._getConnectionString(connectionConfig));
|
|
63
|
+
console.log("knex-ibmi: ", this._getConnectionString(connectionConfig));
|
|
64
64
|
|
|
65
65
|
// @ts-ignore
|
|
66
66
|
if (this.config?.connection?.pool) {
|
|
@@ -87,7 +87,7 @@ class DB2Client extends knex.Client {
|
|
|
87
87
|
// Used to explicitly close a connection, called internally by the pool manager
|
|
88
88
|
// when a connection times out or the pool is shutdown.
|
|
89
89
|
async destroyRawConnection(connection: Connection) {
|
|
90
|
-
console.log("destroy connection");
|
|
90
|
+
console.log("knex-ibmi: ", "destroy connection");
|
|
91
91
|
return await connection.close();
|
|
92
92
|
}
|
|
93
93
|
|
|
@@ -129,7 +129,7 @@ class DB2Client extends knex.Client {
|
|
|
129
129
|
}
|
|
130
130
|
} else {
|
|
131
131
|
await connection.beginTransaction();
|
|
132
|
-
console.log("transaction begun");
|
|
132
|
+
console.log("knex-ibmi: ", "transaction begun");
|
|
133
133
|
try {
|
|
134
134
|
const statement = await connection.createStatement();
|
|
135
135
|
await statement.prepare(obj.sql);
|
|
@@ -172,12 +172,16 @@ class DB2Client extends knex.Client {
|
|
|
172
172
|
await connection.rollback();
|
|
173
173
|
throw new Error(err);
|
|
174
174
|
} finally {
|
|
175
|
-
console.log("transaction committed");
|
|
175
|
+
console.log("knex-ibmi: ", "transaction committed");
|
|
176
176
|
await connection.commit();
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
console.log(
|
|
180
|
+
console.log(
|
|
181
|
+
"knex-ibmi: ",
|
|
182
|
+
obj.sql,
|
|
183
|
+
obj.bindings ? JSON.stringify(obj.bindings) : "",
|
|
184
|
+
);
|
|
181
185
|
return obj;
|
|
182
186
|
}
|
|
183
187
|
|
|
@@ -146,19 +146,6 @@ class IBMiQueryCompiler extends QueryCompiler {
|
|
|
146
146
|
.map((a) => `${a}`)
|
|
147
147
|
.join(", ");
|
|
148
148
|
|
|
149
|
-
// @ts-ignore
|
|
150
|
-
console.log({
|
|
151
|
-
returning,
|
|
152
|
-
// @ts-ignore
|
|
153
|
-
where,
|
|
154
|
-
// @ts-ignore
|
|
155
|
-
updates,
|
|
156
|
-
// @ts-ignore
|
|
157
|
-
single: this.single.update,
|
|
158
|
-
// @ts-ignore
|
|
159
|
-
grouped: this.grouped.where,
|
|
160
|
-
values,
|
|
161
|
-
});
|
|
162
149
|
// @ts-ignore
|
|
163
150
|
const moreWheres =
|
|
164
151
|
// @ts-ignore
|
|
@@ -184,8 +171,6 @@ class IBMiQueryCompiler extends QueryCompiler {
|
|
|
184
171
|
)}`
|
|
185
172
|
: "";
|
|
186
173
|
|
|
187
|
-
console.log({ selectReturning });
|
|
188
|
-
|
|
189
174
|
const sql =
|
|
190
175
|
withSQL +
|
|
191
176
|
// @ts-ignore
|
|
@@ -202,7 +187,6 @@ class IBMiQueryCompiler extends QueryCompiler {
|
|
|
202
187
|
|
|
203
188
|
_returning(method, value, withTrigger) {
|
|
204
189
|
// currently a placeholder in case I need to update return values
|
|
205
|
-
console.log("_returning", value);
|
|
206
190
|
switch (method) {
|
|
207
191
|
case "update":
|
|
208
192
|
case "insert":
|