Remove deprecation warnings

remotes/origin/cdb-6.1^2
Raul Marin 6 years ago
parent 8ce7e13b93
commit b5be2ee38c

@ -27,7 +27,7 @@ var PG = function(clientConstructor) {
util.inherits(PG, EventEmitter); util.inherits(PG, EventEmitter);
PG.prototype.end = util.deprecate(function() { PG.prototype.end = function() {
var self = this; var self = this;
var keys = Object.keys(this._pools); var keys = Object.keys(this._pools);
var count = keys.length; 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") { if(typeof config == "function") {
callback = config; callback = config;
config = null; config = null;
@ -75,10 +75,10 @@ PG.prototype.connect = util.deprecate(function(config, callback) {
}.bind(this)); }.bind(this));
} }
return pool.connect(callback); 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 // 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) { if(client.native) {
return client.cancel(query); return client.cancel(query);
} }
@ -89,7 +89,7 @@ PG.prototype.cancel = util.deprecate(function(config, client, query) {
} }
var cancellingClient = new this.Client(c); var cancellingClient = new this.Client(c);
cancellingClient.cancel(client, query); cancellingClient.cancel(client, query);
}, 'PG.cancel is deprecated - use client.cancel instead'); };
if(typeof process.env.NODE_PG_FORCE_NATIVE != 'undefined') { if(typeof process.env.NODE_PG_FORCE_NATIVE != 'undefined') {
module.exports = new PG(require('./native')); module.exports = new PG(require('./native'));

@ -68,9 +68,9 @@ NativeQuery.prototype._getPromise = function() {
return this._promise; return this._promise;
}; };
NativeQuery.prototype.promise = util.deprecate(function() { NativeQuery.prototype.promise = function() {
return this._getPromise(); return this._getPromise();
}, 'Query.promise() is deprecated - see the upgrade guide at https://node-postgres.com/guides/upgrading'); };
NativeQuery.prototype.handleError = function(err) { NativeQuery.prototype.handleError = function(err) {
var self = this; var self = this;

@ -73,9 +73,9 @@ Query.prototype._getPromise = function () {
return this._promise; return this._promise;
}; };
Query.prototype.promise = util.deprecate(function() { Query.prototype.promise = function() {
return this._getPromise(); return this._getPromise();
}, 'Query.promise() is deprecated - see the upgrade guide at https://node-postgres.com/guides/upgrading'); };
Query.prototype.requiresPreparation = function() { Query.prototype.requiresPreparation = function() {
//named queries must always be prepared //named queries must always be prepared

@ -142,7 +142,6 @@ function normalizeQueryConfig (config, values, callback) {
return config; 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 deprecateEventEmitter = function(Emitter) {
var Result = function () { var Result = function () {
@ -151,8 +150,8 @@ var deprecateEventEmitter = function(Emitter) {
util.inherits(Result, Emitter); util.inherits(Result, Emitter);
Result.prototype._on = Result.prototype.on; Result.prototype._on = Result.prototype.on;
Result.prototype._once = Result.prototype.once; Result.prototype._once = Result.prototype.once;
Result.prototype.on = util.deprecate(Result.prototype.on, queryEventEmitterOverloadDeprecationMessage); Result.prototype.on = Result.prototype.on;
Result.prototype.once = util.deprecate(Result.prototype.once, queryEventEmitterOverloadDeprecationMessage); Result.prototype.once = Result.prototype.once;
return Result; return Result;
}; };

Loading…
Cancel
Save