Remove deprecation warnings

This commit is contained in:
Raul Marin 2018-05-23 16:13:14 +02:00
parent 8ce7e13b93
commit b5be2ee38c
4 changed files with 12 additions and 13 deletions

View File

@ -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'));

View File

@ -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;

View File

@ -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

View File

@ -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;
};