mrepo-sql 1.0.1 → 1.0.3
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/dist/db/repo.js +3 -3
- package/package.json +1 -1
- package/src/db/repo.ts +3 -3
package/dist/db/repo.js
CHANGED
|
@@ -35,17 +35,17 @@ export class BaseRepository {
|
|
|
35
35
|
const placeholders = generateParams(endParams.length);
|
|
36
36
|
const callParams = [
|
|
37
37
|
...(placeholders ? [placeholders] : []),
|
|
38
|
-
...(out.length ? out.map(({ name }) =>
|
|
38
|
+
...(out.length ? out.map(({ name }) => `${name}`) : [])
|
|
39
39
|
].join(',');
|
|
40
40
|
let conn;
|
|
41
41
|
try {
|
|
42
42
|
conn = await this.pool.getConnection();
|
|
43
43
|
const declareOutVars = out.length
|
|
44
|
-
? out.map(({ name, type }) => `SET
|
|
44
|
+
? out.map(({ name, type }) => `SET ${name} = CAST(NULL AS ${type ?? 'VARCHAR(255)'});`).join('\n')
|
|
45
45
|
: '';
|
|
46
46
|
const selectOuts = out.length
|
|
47
47
|
? 'SELECT ' + out
|
|
48
|
-
.map(({ name }) =>
|
|
48
|
+
.map(({ name }) => `${name}`)
|
|
49
49
|
.join(',')
|
|
50
50
|
: '';
|
|
51
51
|
const query = `
|
package/package.json
CHANGED
package/src/db/repo.ts
CHANGED
|
@@ -54,7 +54,7 @@ export class BaseRepository {
|
|
|
54
54
|
|
|
55
55
|
const callParams = [
|
|
56
56
|
...(placeholders ? [placeholders] : []),
|
|
57
|
-
...(out.length ? out.map(({ name }) =>
|
|
57
|
+
...(out.length ? out.map(({ name }) => `${name}`) : [])
|
|
58
58
|
].join(',');
|
|
59
59
|
|
|
60
60
|
let conn;
|
|
@@ -62,12 +62,12 @@ export class BaseRepository {
|
|
|
62
62
|
conn = await this.pool.getConnection();
|
|
63
63
|
|
|
64
64
|
const declareOutVars = out.length
|
|
65
|
-
? out.map(({ name, type }) => `SET
|
|
65
|
+
? out.map(({ name, type }) => `SET ${name} = CAST(NULL AS ${type ?? 'VARCHAR(255)'});`).join('\n')
|
|
66
66
|
: '';
|
|
67
67
|
|
|
68
68
|
const selectOuts = out.length
|
|
69
69
|
? 'SELECT ' + out
|
|
70
|
-
.map(({ name }) =>
|
|
70
|
+
.map(({ name }) => `${name}`)
|
|
71
71
|
.join(',')
|
|
72
72
|
: '';
|
|
73
73
|
|