From 59f6cba17839435e3c10d9e1011d5b78e4a970f0 Mon Sep 17 00:00:00 2001 From: godfrey Date: Wed, 3 Jan 2018 23:56:34 +0800 Subject: [PATCH] Set toNative() to be not enumerable (#2388) --- src/query/compiler.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/query/compiler.js b/src/query/compiler.js index cf4b7f1b5f..eeec893a59 100644 --- a/src/query/compiler.js +++ b/src/query/compiler.js @@ -52,13 +52,21 @@ assign(QueryCompiler.prototype, { timeout: this.timeout, cancelOnTimeout: this.cancelOnTimeout, bindings: this.formatter.bindings || [], - __knexQueryUid: uuid.v4(), - toNative: () => ({ - sql: this.client.positionBindings(query.sql), - bindings: this.client.prepBindings(query.bindings) - }) + __knexQueryUid: uuid.v4() }; + Object.defineProperties(query, { + toNative: { + value: () => { + return { + sql: this.client.positionBindings(query.sql), + bindings: this.client.prepBindings(query.bindings) + }; + }, + enumerable: false + } + }); + if (isString(val)) { query.sql = val; } else {