Skip to content

Commit a44551b

Browse files
author
ArnaudSpanneut
committed
fix(get): Call the right param value
1 parent 07e95a3 commit a44551b

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

angular-sql-query.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@
352352
function prepareSimpleQuery(tableName, queryAsObject) {
353353
return {
354354
query: getSimpleQuery(queryAsObject),
355-
params: Object.keys(queryAsObject.self).reduce(function (arr, column, index, selfDatas) {
355+
params: Object.keys(queryAsObject.self).reduce(function (arr, column) {
356356
return arr.concat(queryAsObject.self[column]);
357357
}, [])
358358
};
@@ -398,7 +398,7 @@
398398
return paramKey + '=?';
399399
}).join(' AND ');
400400
var queryParamsValues = queryParamsKeys.map(function (paramKey) {
401-
return queryParamsKeys[paramKey];
401+
return params[paramKey];
402402
});
403403

404404
return {

angular-sql-query.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/angular-sql-query.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@
365365
return {
366366
query: getSimpleQuery(queryAsObject),
367367
params: Object.keys(queryAsObject.self)
368-
.reduce((arr, column, index, selfDatas) => arr.concat(
368+
.reduce((arr, column) => arr.concat(
369369
queryAsObject.self[column]),
370370
[]
371371
),
@@ -417,7 +417,7 @@
417417
.map(paramKey => `${paramKey}=?`)
418418
.join(' AND ');
419419
const queryParamsValues = queryParamsKeys
420-
.map(paramKey => queryParamsKeys[paramKey]);
420+
.map(paramKey => params[paramKey]);
421421

422422
return {
423423
query: (dataDefinition) ?

src/angular-sql-query.spec.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
$timeout.flush();
8282

8383
expect(data).equal('fail');
84-
// console.log($exceptionHandler.errors);
8584
expect($exceptionHandler.errors).lengthOf(1);
8685
}));
8786

@@ -275,7 +274,6 @@
275274
testInsertReqParams(8, 1500, 500);
276275
testInsertReqParams(9, 2000, 10);
277276
expect(args[10][0]).contain('SELECT * FROM test WHERE test3 IN (?) AND test IN (SELECT value FROM tmp_test_test) AND test2 IN (SELECT value FROM tmp_test_test2);');
278-
console.log(data);
279277
// expect(data).lengthOf(1);
280278
}));
281279

0 commit comments

Comments
 (0)