Updated FAQ (markdown)

brianc 2011-05-26 12:25:19 -07:00
parent 69b7fb7ffb
commit 2d8c8d5168

14
FAQ.md

@ -30,7 +30,17 @@ client.query(..., function(err, result) {
### 4. (Alert! Possibly an idiot question) How do you get the count of columns in the result set ? ###
### 5. (Alert! Possibly an idiot question) If pg returns query data in JSON format, for web serivce applications, it would make sense to return that directly to the client. If this assumption is correct what is the most efficient method? ###
### 5. If pg returns query data in JSON format, for web serivce applications, it would make sense to return that directly to the client. If this assumption is correct what is the most efficient method? ###
```js
http.CreateServer(function(req, res) {
//NOTE: pg connection boilerplate not present
pg.query(..., function(err, result) {
//NOTE: error handling not present
var json = JSON.stringify(result.rows);
res.writeHead(200, {'content-type':'application/json', 'content-length':json.length});
res.end(json);
});
})
```
Thank you Brian. pg is excellent.