From 8e3dbf7b19bd3b5c6106763998c08a600e2fc526 Mon Sep 17 00:00:00 2001 From: igalklebanov Date: Mon, 2 Sep 2024 12:22:45 +0300 Subject: [PATCH] add `appendSerializedValue`. --- src/query-compiler/default-query-compiler.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/query-compiler/default-query-compiler.ts b/src/query-compiler/default-query-compiler.ts index e33a7fdfa..01fe5761f 100644 --- a/src/query-compiler/default-query-compiler.ts +++ b/src/query-compiler/default-query-compiler.ts @@ -502,12 +502,10 @@ export class DefaultQueryCompiler protected override visitValue(node: ValueNode): void { if (node.immediate) { this.appendImmediateValue(node.value) + } else if (node.serialized) { + this.appendSerializedValue(node.value) } else { - this.appendValue( - node.serialized && node.value !== null - ? JSON.stringify(node.value) - : node.value, - ) + this.appendValue(node.value) } } @@ -1665,6 +1663,14 @@ export class DefaultQueryCompiler this.append(this.getCurrentParameterPlaceholder()) } + protected appendSerializedValue(parameter: unknown): void { + if (parameter === null) { + this.appendValue(null) + } else { + this.appendValue(JSON.stringify(parameter)) + } + } + protected getLeftIdentifierWrapper(): string { return '"' }