From 14e88f268ccb38883d7d40b5240f68877c55a631 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Aug 2026 17:25:57 +0000 Subject: [PATCH 1/3] Initial plan From c886f175feb4051574d6f6c5efd96994ed53eace Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Aug 2026 17:28:49 +0000 Subject: [PATCH 2/3] fix(update): bind params for subqueries in update where Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com> --- src/74update.js | 1 + test/test684.js | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 test/test684.js diff --git a/src/74update.js b/src/74update.js index c189bd2c9b..78034830f9 100755 --- a/src/74update.js +++ b/src/74update.js @@ -82,6 +82,7 @@ yy.Update.prototype.compile = function (databaseid) { var statement = function (params, cb) { var db = alasql.databases[databaseid]; + self.params = params; // console.log(db.engineid); // console.log(db.engineid && alasql.engines[db.engineid].updateTable); diff --git a/test/test684.js b/test/test684.js new file mode 100644 index 0000000000..3d9e55ef87 --- /dev/null +++ b/test/test684.js @@ -0,0 +1,41 @@ +if (typeof exports === 'object') { + var assert = require('assert'); + var alasql = require('..'); +} + +let testId = '684'; + +describe(`Test ${testId} - update subquery parameter binding`, function () { + before(function () { + alasql('create database test' + testId); + alasql('use test' + testId); + }); + + after(function () { + alasql('drop database test' + testId); + }); + + it('should bind parameters inside subquery in UPDATE WHERE clause', function () { + let res = []; + res.push(alasql('CREATE TABLE one ([Field1] STRING, [Field2] INT, [Field3] STRING)')); + res.push(alasql("INSERT INTO one VALUES ('Old',10,'aaa'),('Old',10,'bbb'),('Old',20,'ccc')")); + res.push( + alasql( + "UPDATE one SET [Field1] = 'New' WHERE [Field2] = (SELECT [Field2] FROM one WHERE [Field3] = ?)", + ['aaa'] + ) + ); + res.push(alasql('SELECT [Field1],[Field2],[Field3] FROM one ORDER BY [Field2],[Field3]')); + + assert.deepStrictEqual(res, [ + 1, + 3, + 2, + [ + {Field1: 'New', Field2: 10, Field3: 'aaa'}, + {Field1: 'New', Field2: 10, Field3: 'bbb'}, + {Field1: 'Old', Field2: 20, Field3: 'ccc'}, + ], + ]); + }); +}); From fbb16ef584c6ae55f1e9aa334d2793effbf9f3f0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 7 Sep 2026 14:11:02 +0000 Subject: [PATCH 3/3] test: stabilize HTTPS binary loading check --- test/test2112.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test2112.js b/test/test2112.js index e830c96568..6254efa8c6 100644 --- a/test/test2112.js +++ b/test/test2112.js @@ -21,10 +21,10 @@ describe('Test 2112 - load binary file', function () { it('C) Loads HTTPS binary file (async)', function (done) { alasql.utils.loadBinaryFile( - 'https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg', + 'https://github.com/AlaSQL/alasql/raw/refs/heads/develop/test/test2112.dat', true, function (data) { - assert.equal(data.slice(0, 3), 'ÿØÿ'); + assert.equal(data, '�'); done(); } );