From 1c5092a42b370cad06317cb802a35cedf7465b01 Mon Sep 17 00:00:00 2001 From: Kushal Krishna Date: Fri, 28 Jun 2024 15:12:04 +0530 Subject: [PATCH] Fixed EXISTS function in subqueries and SET operations --- src/41exists.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/41exists.js b/src/41exists.js index 0a934af412..bd7cf8beb6 100755 --- a/src/41exists.js +++ b/src/41exists.js @@ -1,8 +1,9 @@ /* // -// EXISTS and other subqueries functions functions for Alasql.js +// EXISTS and other subqueries functions for AlaSQL.js // Date: 03.11.2014 // (c) 2014, Andrey Gershun +// Modified by: Midwayne // */ @@ -20,12 +21,13 @@ yy.ExistsValue = class ExistsValue { } toJS(context, tableid, defcols) { - return `this.existsfn[${this.existsidx}](params, null, ${context}).data.length`; + // Updated to return a boolean value correctly + return `!!this.existsfn[${this.existsidx}](params, null, ${context}).data.length`; } }; // -// Prepare subqueries and exists +// Prepare subqueries and EXISTS // alasql.precompile = function (statement, databaseid, params) { if (!statement) return;