@saltcorn/postgres 0.9.5-beta.2 → 0.9.5-beta.20

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/postgres.js +4 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/postgres",
3
- "version": "0.9.5-beta.2",
3
+ "version": "0.9.5-beta.20",
4
4
  "description": "Postgres structures for Saltcorn, open-source no-code platform",
5
5
  "homepage": "https://saltcorn.com",
6
6
  "scripts": {
@@ -12,7 +12,7 @@
12
12
  "license": "MIT",
13
13
  "main": "index.js",
14
14
  "dependencies": {
15
- "@saltcorn/db-common": "0.9.5-beta.2",
15
+ "@saltcorn/db-common": "0.9.5-beta.20",
16
16
  "pg": "^8.2.1",
17
17
  "pg-copy-streams": "^5.1.1"
18
18
  },
package/postgres.js CHANGED
@@ -97,7 +97,9 @@ const select = async (tbl, whereObj, selectopts = {}) => {
97
97
  const sql = `SELECT ${
98
98
  selectopts.fields ? selectopts.fields.join(", ") : `*`
99
99
  } FROM "${schema}"."${sqlsanitize(tbl)}" ${where} ${mkSelectOptions(
100
- selectopts
100
+ selectopts,
101
+ values,
102
+ false
101
103
  )}`;
102
104
  sql_log(sql, values);
103
105
  const tq = await (client || selectopts.client || pool).query(sql, values);
@@ -188,7 +190,7 @@ const insert = async (tbl, obj, opts = {}) => {
188
190
  var valPosList = [];
189
191
  var valList = [];
190
192
  const schema = opts.schema || getTenantSchema();
191
- let conflict = "";
193
+ const conflict = opts.onConflictDoNothing ? "on conflict do nothing " : "";
192
194
  kvs.forEach(([k, v]) => {
193
195
  if (v && v.next_version_by_id) {
194
196
  valList.push(v.next_version_by_id);
@@ -197,7 +199,6 @@ const insert = async (tbl, obj, opts = {}) => {
197
199
  tbl
198
200
  )}" where id=$${valList.length}), 0)+1`
199
201
  );
200
- if (opts.onConflictDoNothing) conflict = "on conflict do nothing ";
201
202
  } else {
202
203
  valList.push(v);
203
204
  valPosList.push(`$${valList.length}`);