Update README.md
This commit is contained in:
parent
2ad1ad4d24
commit
95a5bba4bf
12
README.md
12
README.md
@ -24,13 +24,11 @@ var conString = "tcp://postgres:1234@localhost/postgres";
|
||||
var client = new pg.Client(conString);
|
||||
client.connect(function(err) {
|
||||
if(err) {
|
||||
console.error('could not connect to postgres', err);
|
||||
return;
|
||||
return console.error('could not connect to postgres', err);
|
||||
}
|
||||
client.query('SELECT NOW() AS "theTime"', function(err, result) {
|
||||
if(err) {
|
||||
console.error('error running query', err);
|
||||
return;
|
||||
return console.error('error running query', err);
|
||||
}
|
||||
console.log(result.rows[0].theTime);
|
||||
//output: Tue Jan 15 2013 19:12:47 GMT-600 (CST)
|
||||
@ -50,16 +48,14 @@ var conString = "tcp://postgres:1234@localhost/postgres";
|
||||
|
||||
pg.connect(conString, function(err, client, done) {
|
||||
if(err) {
|
||||
console.error('error fetching client from pool', err);
|
||||
return;
|
||||
return console.error('error fetching client from pool', err);
|
||||
}
|
||||
client.query('SELECT $1::int AS numbor', ['1'], function(err, result) {
|
||||
//call `done()` to release the client back to the pool
|
||||
done();
|
||||
|
||||
if(err) {
|
||||
console.error('error running query', err);
|
||||
return;
|
||||
return console.error('error running query', err);
|
||||
}
|
||||
console.log(result.rows[0].numbor);
|
||||
//output: 1
|
||||
|
Loading…
Reference in New Issue
Block a user