Skip to content

Commit 225bbd5

Browse files
authored
Merge pull request #35 from wikimedia/overwrites
Support overwrites if the tid matches
2 parents db54a17 + 5c90181 commit 225bbd5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/dbutils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ dbu.extractGetParams = function(query, schema, includePreparedForDelete) {
480480

481481
function buildUpdateQuery(req, tableName, schema, dataKVMap, primaryKeyKVMap, ignore) {
482482
var dataParams = [];
483-
var condition = buildCondition(Object.assign(primaryKeyKVMap, req.if), schema, false, true);
483+
var condition = buildCondition(Object.assign(primaryKeyKVMap, req.if), schema, true, true);
484484
var sql = (ignore ? 'update or ignore ' : 'update ') + '[' + tableName + '_data] set ';
485485
sql += Object.keys(dataKVMap).filter(function(column) {
486486
return schema.iKeys.indexOf(column) < 0;
@@ -569,7 +569,7 @@ dbu.buildPutQuery = function(req, tableName, schema, ignoreStatic) {
569569
} else {
570570
if (Object.keys(dataKVMap).length > Object.keys(primaryKeyKVMap).length) {
571571
queries.push(buildUpdateQuery(req, tableName, schema,
572-
dataKVMap, primaryKeyKVMap, true));
572+
dataKVMap, primaryKeyKVMap, false));
573573
}
574574
queries.push(buildInsertQuery(tableName, dataKVMap));
575575
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "restbase-mod-table-sqlite",
33
"description": "RESTBase table storage using sqlite for testing purposes",
4-
"version": "0.1.17",
4+
"version": "0.1.18",
55
"main": "index.js",
66
"repository": {
77
"type": "git",

0 commit comments

Comments
 (0)