mirror of
https://gitlab.silvrtree.co.uk/martind2000/obrandDBWork.git
synced 2025-01-10 17:45:07 +00:00
29 lines
524 B
JavaScript
29 lines
524 B
JavaScript
/**
|
|
*
|
|
* User: Martin Donnelly
|
|
* Date: 2016-03-09
|
|
* Time: 11:44
|
|
*
|
|
*/
|
|
'use strict';
|
|
var pg = require('pg');
|
|
|
|
var conString = 'postgres://postgres:MPReoa43@localhost/oBrand';
|
|
|
|
pg.connect(conString, function(err, client, done) {
|
|
|
|
if(err) {
|
|
return console.error('error fetching client from pool',err);
|
|
}
|
|
client.query('select $1::int as number',[1], function(err,result) {
|
|
done();
|
|
|
|
if (err) {
|
|
return console.error('error running query', err);
|
|
|
|
}
|
|
|
|
console.log(result.rows[0].number);
|
|
|
|
})
|
|
}); |