From 9bf31060e162cd9f652ac63072a1dd6fd68e32f6 Mon Sep 17 00:00:00 2001 From: "Brian M. Carlson" Date: Wed, 15 Jul 2020 12:22:13 -0500 Subject: [PATCH] Cleanup some dead code --- packages/pg/lib/connection.js | 2 -- packages/pg/lib/query.js | 53 ++++++++++++++--------------------- 2 files changed, 21 insertions(+), 34 deletions(-) diff --git a/packages/pg/lib/connection.js b/packages/pg/lib/connection.js index 0aa3c096..2142a401 100644 --- a/packages/pg/lib/connection.js +++ b/packages/pg/lib/connection.js @@ -154,13 +154,11 @@ class Connection extends EventEmitter { } // send bind message - // "more" === true to buffer the message until flush() is called bind(config) { this._send(serialize.bind(config)) } // send execute message - // "more" === true to buffer the message until flush() is called execute(config) { this._send(serialize.execute(config)) } diff --git a/packages/pg/lib/query.js b/packages/pg/lib/query.js index 2392b710..37098ac8 100644 --- a/packages/pg/lib/query.js +++ b/packages/pg/lib/query.js @@ -176,30 +176,26 @@ class Query extends EventEmitter { } _getRows(connection, rows) { - connection.execute( - { - portal: this.portal, - rows: rows, - }, - true - ) + connection.execute({ + portal: this.portal, + rows: rows, + }) connection.flush() } + // http://developer.postgresql.org/pgdocs/postgres/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY prepare(connection) { // prepared statements need sync to be called after each command // complete or when an error is encountered this.isPreparedStatement = true + // TODO refactor this poor encapsulation if (!this.hasBeenParsed(connection)) { - connection.parse( - { - text: this.text, - name: this.name, - types: this.types, - }, - true - ) + connection.parse({ + text: this.text, + name: this.name, + types: this.types, + }) } if (this.values) { @@ -211,24 +207,17 @@ class Query extends EventEmitter { } } - // http://developer.postgresql.org/pgdocs/postgres/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY - connection.bind( - { - portal: this.portal, - statement: this.name, - values: this.values, - binary: this.binary, - }, - true - ) + connection.bind({ + portal: this.portal, + statement: this.name, + values: this.values, + binary: this.binary, + }) - connection.describe( - { - type: 'P', - name: this.portal || '', - }, - true - ) + connection.describe({ + type: 'P', + name: this.portal || '', + }) this._getRows(connection, this.rows) }