From 322d80982c009d9a9f334d2051db182315b4e5b4 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Mon, 8 May 2023 17:23:53 +0530 Subject: [PATCH] fix: corrections and improvements Signed-off-by: Pranav C --- packages/nocodb/src/db/sql-client/lib/KnexClient.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/nocodb/src/db/sql-client/lib/KnexClient.ts b/packages/nocodb/src/db/sql-client/lib/KnexClient.ts index b836721370..8867fbb55b 100644 --- a/packages/nocodb/src/db/sql-client/lib/KnexClient.ts +++ b/packages/nocodb/src/db/sql-client/lib/KnexClient.ts @@ -2972,19 +2972,19 @@ class KnexClient extends SqlClient { if (value === null || value === undefined) return undefined; if (typeof value === 'string') { - // i value is null or true or false, return as is - if (value === 'NULL' || value === 'null') return 'NULL'; - if (value === 'true' || value === 'true') return 'true'; + // if value is null/true/false return as is + if (['NULL', 'null', 'TRUE', 'true', 'FALSE', 'false'].includes(value)) + return value; // if value is a number, return as is if (/^\d+(\.\d+)?$/.test(value)) return value; // if value is a function, return as is + // for example: CURRENT_TIMESTAMP(), NOW(), UUID(), etc if (/^\w+\(\)$/.test(value)) return value; // if value is a CURRENT_TIMESTAMP, return as is - if (/^CURRENT_TIMESTAMP[\w ]*$/.test(value.toUpperCase())) - return value; + if (/^CURRENT_TIMESTAMP[\w ]*$/.test(value.toUpperCase())) return value; // if value wrapped in single/double quotes, then extract value and sanitise const m = value.match(/^(['"])(.*)\1$/);