Socket
Socket
Sign inDemoInstall

pg

Package Overview
Dependencies
Maintainers
0
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

1

lib/client.js

@@ -20,3 +20,2 @@ var sys = require('sys');

this.host = config.host || defaults.host;
this.queryQueue = [];
this.connection = config.connection || new Connection({stream: config.stream});

@@ -23,0 +22,0 @@ this.queryQueue = [];

8

lib/query.js

@@ -12,2 +12,4 @@ var EventEmitter = require('events').EventEmitter;

this.name = config.name;
//use unique portal name each time
this.portal = config.portal || ""
this.callback = config.callback;

@@ -105,3 +107,3 @@ this._fieldNames = [];

connection.execute({
portal: this.name,
portal: this.portalName,
rows: this.rows

@@ -136,3 +138,3 @@ }, true);

connection.bind({
portal: self.name,
portal: self.portalName,
statement: self.name,

@@ -144,3 +146,3 @@ values: self.values

type: 'P',
name: self.name || ""
name: self.portalName || ""
}, true);

@@ -147,0 +149,0 @@

{ "name": "pg",
"version": "0.5.0",
"version": "0.5.1",
"description": "PostgreSQL client - pure javascript & libpq with the same API",

@@ -4,0 +4,0 @@ "keywords" : ["postgres", "pg", "libpq", "postgre", "database", "rdbms"],

@@ -61,3 +61,3 @@ #node-postgres

});
var query = client.query("SELECT * FROM beatles WHERE name = $1", ['john']);
var query = client.query("SELECT * FROM beatles WHERE name = $1", ['John']);

@@ -64,0 +64,0 @@ //can stream row results back 1 at a time

var helper = require(__dirname + '/test-helper');
var sys = require('sys')

@@ -18,3 +19,3 @@ var createErorrClient = function() {

var query = client.query("select omfg from yodas_soda where pixistix = 'zoiks!!!'");
var query = client.query("select omfg from yodas_dsflsd where pixistix = 'zoiks!!!'");

@@ -36,2 +37,3 @@ assert.emits(query, 'error', function(error) {

test("when query is parsing", function() {
//this query wont parse since there ain't no table named bang

@@ -59,3 +61,4 @@

test("when a query is binding", function() {
test("when a query is binding", function() {
var query = client.query({

@@ -67,2 +70,3 @@ text: 'select * from boom where age = $1',

test("query emits the error", function() {
assert.emits(query, 'error', function(err) {

@@ -94,2 +98,3 @@ test('error has right severity', function() {

test('when connecting to invalid host', function() {
return false;
var client = new Client({

@@ -103,1 +108,27 @@ user: 'brian',

})
test('multiple connection errors (gh#31)', function() {
return false;
test('with single client', function() {
//don't run yet...this test fails...need to think of fix
var client = new Client({
user: 'blaksdjf',
password: 'omfsadfas',
host: helper.args.host,
port: helper.args.port,
database: helper.args.database
})
client.connect();
assert.emits(client, 'error', function(e) {
client.connect();
assert.emits(client, 'error')
})
})
test('with callback method', function() {
var badConString = "tcp://aslkdfj:oi14081@"+helper.args.host+":"+helper.args.port+"/"+helper.args.database;
return false;
})
})

@@ -49,1 +49,27 @@ var helper = require(__dirname + '/test-helper');

})
test('gh#36', function() {
var connectionString = helper.connectionString();
helper.pg.connect(connectionString, function(err, client) {
if(err) throw err;
client.query("BEGIN");
client.query({
name: 'X',
text: "SELECT $1::INTEGER",
values: [0]
}, assert.calls(function(err, result) {
if(err) throw err;
assert.equal(result.rows.length, 1);
}))
client.query({
name: 'X',
text: "SELECT $1::INTEGER",
values: [0]
}, assert.calls(function(err, result) {
if(err) throw err;
assert.equal(result.rows.length, 1);
}))
client.query("COMMIT")
client.on('drain', client.end.bind(client))
})
})

@@ -219,3 +219,3 @@ require(__dirname + '/test-helper');

port: 5432,
host: 'example.com'
host: 'localhost'
}

@@ -226,3 +226,3 @@ utils.buildLibpqConnectionString(config, assert.calls(function(err, constring) {

checkForPart(parts, "user='brian'")
checkForPart(parts, "hostaddr=192.0.32.10")
checkForPart(parts, "hostaddr=127.0.0.1")
}))

@@ -229,0 +229,0 @@ })

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