Skip to content

Instantly share code, notes, and snippets.

@dvv
Created April 19, 2011 20:51
Show Gist options
  • Save dvv/929626 to your computer and use it in GitHub Desktop.
Save dvv/929626 to your computer and use it in GitHub Desktop.
var pg = require('pg').native;
var conString = 'postgres://dvv:XXX@localhost/postgres';
var client = new pg.Client(conString);
client.on('drain', client.end.bind(client));
client.connect();
console.log('NODE: ', process.version);
client.query('drop table foo');
client.query('create table foo(id serial)');
client.query({
name: 'select * from foo where id = $1',
text: 'select * from foo where id = $1'
});
=================
Linux DVV 2.6.32-5-686 #1 SMP Wed Jan 12 04:01:41 UTC 2011 i686 GNU/Linux
NODE: v0.5.0-pre
events.js:47
throw new Error("Uncaught, unspecified 'error' event.");
^
Error: Uncaught, unspecified 'error' event.
at [object Object].emit (events.js:47:15)
at [object Object].handleError (/usr/local/lib/node/.npm/pg/0.4.0/package/lib/native.js:185:10)
at Connection.<anonymous> (/usr/local/lib/node/.npm/pg/0.4.0/package/lib/native.js:106:31)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment