Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pg.js

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg.js - npm Package Compare versions

Comparing version 2.8.0 to 2.8.1

71

lib/client.js

@@ -88,3 +88,4 @@ var crypto = require('crypto');

con.once('readyForQuery', function() {
//delegate row descript to active query
//delegate rowDescription to active query
con.on('rowDescription', function(msg) {

@@ -94,3 +95,3 @@ self.activeQuery.handleRowDescription(msg);

//delegate datarow to active query
//delegate dataRow to active query
con.on('dataRow', function(msg) {

@@ -100,14 +101,10 @@ self.activeQuery.handleDataRow(msg);

//TODO should query gain access to connection?
//delegate portalSuspended to active query
con.on('portalSuspended', function(msg) {
self.activeQuery.getRows(con);
self.activeQuery.handlePortalSuspended(con);
});
//delegate commandComplete to active query
con.on('commandComplete', function(msg) {
//delegate command complete to query
self.activeQuery.handleCommandComplete(msg);
//need to sync after each command complete of a prepared statement
if(self.activeQuery.isPreparedStatement) {
con.sync();
}
self.activeQuery.handleCommandComplete(msg, con);
});

@@ -134,10 +131,2 @@

if (!callback) {
self.emit('connect');
} else {
callback(null,self);
//remove callback for proper error handling after the connect event
callback = null;
}
con.on('notification', function(msg) {

@@ -147,20 +136,19 @@ self.emit('notification', msg);

//process possible callback argument to Client#connect
if (callback) {
callback(null, self);
//remove callback for proper error handling
//after the connect event
callback = null;
}
self.emit('connect');
});
con.on('readyForQuery', function() {
var error;
if(self.activeQuery) {
//try/catch/rethrow to ensure exceptions don't prevent the queryQueue from
//being processed
try{
self.activeQuery.handleReadyForQuery();
} catch(e) {
error = e;
}
}
var activeQuery = self.activeQuery;
self.activeQuery = null;
self.readyForQuery = true;
self._pulseQueryQueue();
if(error) {
throw error;
if(activeQuery) {
activeQuery.handleReadyForQuery();
}

@@ -170,17 +158,11 @@ });

con.on('error', function(error) {
if(!self.activeQuery) {
if(!callback) {
self.emit('error', error);
} else {
callback(error);
}
} else {
//need to sync after error during a prepared statement
if(self.activeQuery.isPreparedStatement) {
con.sync();
}
if(self.activeQuery) {
var activeQuery = self.activeQuery;
self.activeQuery = null;
activeQuery.handleError(error);
return activeQuery.handleError(error, con);
}
if(!callback) {
return self.emit('error', error);
}
callback(error);
});

@@ -190,3 +172,4 @@

if(self.activeQuery) {
self.activeQuery.handleError(new Error('Stream unexpectedly ended during query execution'));
var disconnectError = new Error('Stream unexpectedly ended during query execution');
self.activeQuery.handleError(disconnectError);
self.activeQuery = null;

@@ -311,3 +294,3 @@ }

//can take in strings, config object or query object
var query = (config instanceof Query) ? config :
var query = (typeof config.submit == 'function') ? config :
new Query(config, values, callback);

@@ -314,0 +297,0 @@ if(this.binary && !query.binary) {

@@ -71,4 +71,8 @@ var EventEmitter = require('events').EventEmitter;

Query.prototype.handleCommandComplete = function(msg) {
Query.prototype.handleCommandComplete = function(msg, con) {
this._result.addCommandComplete(msg);
//need to sync after each command complete of a prepared statement
if(this.isPreparedStatement) {
con.sync();
}
};

@@ -86,3 +90,7 @@

Query.prototype.handleError = function(err) {
Query.prototype.handleError = function(err, connection) {
//need to sync after error during a prepared statement
if(this.isPreparedStatement) {
connection.sync();
}
if(this._canceledDueToError) {

@@ -115,6 +123,10 @@ err = this._canceledDueToError;

Query.prototype.getRows = function(connection) {
Query.prototype.handlePortalSuspended = function(connection) {
this._getRows(connection, this.rows);
};
Query.prototype._getRows = function(connection, rows) {
connection.execute({
portal: this.portalName,
rows: this.rows
rows: rows
}, true);

@@ -161,3 +173,3 @@ connection.flush();

this.getRows(connection);
this._getRows(connection, this.rows);
};

@@ -164,0 +176,0 @@

{
"name": "pg.js",
"version": "2.8.0",
"version": "2.8.1",
"description": "node-postgres without the bindings",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc