From b5be2ee38cd21762c6473ceb3fb9e7110dd287f1 Mon Sep 17 00:00:00 2001 From: Raul Marin Date: Wed, 23 May 2018 16:13:14 +0200 Subject: [PATCH] Remove deprecation warnings --- lib/index.js | 12 ++++++------ lib/native/query.js | 4 ++-- lib/query.js | 4 ++-- lib/utils.js | 5 ++--- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/index.js b/lib/index.js index 17abb5b..a2c2792 100644 --- a/lib/index.js +++ b/lib/index.js @@ -27,7 +27,7 @@ var PG = function(clientConstructor) { util.inherits(PG, EventEmitter); -PG.prototype.end = util.deprecate(function() { +PG.prototype.end = function() { var self = this; var keys = Object.keys(this._pools); var count = keys.length; @@ -47,9 +47,9 @@ PG.prototype.end = util.deprecate(function() { }); }); } -}, 'PG.end is deprecated - please see the upgrade guide at https://node-postgres.com/guides/upgrading'); +}; -PG.prototype.connect = util.deprecate(function(config, callback) { +PG.prototype.connect = function(config, callback) { if(typeof config == "function") { callback = config; config = null; @@ -75,10 +75,10 @@ PG.prototype.connect = util.deprecate(function(config, callback) { }.bind(this)); } return pool.connect(callback); -}, 'PG.connect is deprecated - please see the upgrade guide at https://node-postgres.com/guides/upgrading'); +}; // cancel the query running on the given client -PG.prototype.cancel = util.deprecate(function(config, client, query) { +PG.prototype.cancel = function(config, client, query) { if(client.native) { return client.cancel(query); } @@ -89,7 +89,7 @@ PG.prototype.cancel = util.deprecate(function(config, client, query) { } var cancellingClient = new this.Client(c); cancellingClient.cancel(client, query); -}, 'PG.cancel is deprecated - use client.cancel instead'); +}; if(typeof process.env.NODE_PG_FORCE_NATIVE != 'undefined') { module.exports = new PG(require('./native')); diff --git a/lib/native/query.js b/lib/native/query.js index 88e19f5..214488f 100644 --- a/lib/native/query.js +++ b/lib/native/query.js @@ -68,9 +68,9 @@ NativeQuery.prototype._getPromise = function() { return this._promise; }; -NativeQuery.prototype.promise = util.deprecate(function() { +NativeQuery.prototype.promise = function() { return this._getPromise(); -}, 'Query.promise() is deprecated - see the upgrade guide at https://node-postgres.com/guides/upgrading'); +}; NativeQuery.prototype.handleError = function(err) { var self = this; diff --git a/lib/query.js b/lib/query.js index b8f6d77..e9c3d15 100644 --- a/lib/query.js +++ b/lib/query.js @@ -73,9 +73,9 @@ Query.prototype._getPromise = function () { return this._promise; }; -Query.prototype.promise = util.deprecate(function() { +Query.prototype.promise = function() { return this._getPromise(); -}, 'Query.promise() is deprecated - see the upgrade guide at https://node-postgres.com/guides/upgrading'); +}; Query.prototype.requiresPreparation = function() { //named queries must always be prepared diff --git a/lib/utils.js b/lib/utils.js index 56a45cb..cd3ee2e 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -142,7 +142,6 @@ function normalizeQueryConfig (config, values, callback) { return config; } -var queryEventEmitterOverloadDeprecationMessage = 'Using the automatically created return value from client.query as an event emitter is deprecated and will be removed in pg@7.0. Please see the upgrade guide at https://node-postgres.com/guides/upgrading'; var deprecateEventEmitter = function(Emitter) { var Result = function () { @@ -151,8 +150,8 @@ var deprecateEventEmitter = function(Emitter) { util.inherits(Result, Emitter); Result.prototype._on = Result.prototype.on; Result.prototype._once = Result.prototype.once; - Result.prototype.on = util.deprecate(Result.prototype.on, queryEventEmitterOverloadDeprecationMessage); - Result.prototype.once = util.deprecate(Result.prototype.once, queryEventEmitterOverloadDeprecationMessage); + Result.prototype.on = Result.prototype.on; + Result.prototype.once = Result.prototype.once; return Result; };