Get results in wide format
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Is there an easy way to call db.exec and get the results in the conventional format:
[
{ "person" : "jerry", "age" : 34 },
{ "person" : "mary", "age": 37 },
{ "person" : "joe", "age" : 63 }
]
I am currently using:
var out = []
var res = db.prepare("SELECT * FROM hello");
while (stmt.step()) out.push(stmt.getAsObject());
But push() can be inefficient. It would be nice to have a shorthand for this.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the db.exec and prepare/step/getAsObject entry points shown in the issue, and inspect how query results are currently assembled. Done means a supported shorthand returns rows in the requested array-of-objects format without requiring the manual loop.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, sqlite
- Domain
- database
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100