mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
25 lines
598 B
JavaScript
25 lines
598 B
JavaScript
Client = require(__dirname+'/../../lib/client');
|
|
sys = require('sys');
|
|
|
|
//creates a configured, connecting client
|
|
var connect = function(onReady) {
|
|
var con = new Client({
|
|
database: 'postgres',
|
|
user: 'brian'
|
|
});
|
|
con.connect();
|
|
con.once('readyForQuery', function() {
|
|
con.query('create temporary table ids(id integer)');
|
|
con.once('readyForQuery', function() {
|
|
con.query('insert into ids(id) values(1); insert into ids(id) values(2);');
|
|
con.once('readyForQuery',function() {
|
|
onReady(con);
|
|
});
|
|
});
|
|
});
|
|
};
|
|
|
|
module.exports = {
|
|
connect: connect
|
|
};
|