mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-25 16:03:13 +00:00
Corrected #3, since this is definitely possible in current builds.
parent
8c3448c0c3
commit
6c005061a6
7
FAQ.md
7
FAQ.md
@ -29,7 +29,12 @@ client.query(..., function(err, result) {
|
||||
|
||||
### 3. Assuming a recordset is enumerated using the array accessor style used in 1, can we get the column names in the same fashion, i.e. is there a result.rows[i].columnName property? ###
|
||||
|
||||
Not currently. It would be helpful to access the column values by column name or index position, but it's not part of the node-postgres api for now.
|
||||
This is possible using the `result.fields` array:
|
||||
```js
|
||||
client.query(..., function(err, result) {
|
||||
console.log("Returned columns:", result.fields.map(function(f) { return f.name; }).join(', '));
|
||||
});
|
||||
```
|
||||
|
||||
### 4. How do you get the count of columns in the result set ? ###
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user