sidorares / sidorares/node-mysql2
namedPlaceholders with IN clause
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- TypeScript
- Stars
- 4.4k
- Forks
- 680
- Avg merge
- 9h 7m
- Merged PRs (30d)
- 59
Description
It would be nice to have namedPlaceholders convert arrays of data into an IN clause.
I would like the following to be possible:
var parms = {
keys: [1,2,3,4,5,6,7]
};
db.pool.execute('SELECT id FROM table WHERE id IN (:keys)', parms, function(res, err) {
});
It should execute to the following:
SELECT id FROM table WHERE id IN (?,?,?,?,?,?,?)
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 namedPlaceholders handling in the mysql2 codebase and locating existing tests for parameter conversion. Check how array values are currently processed, then add coverage for the provided IN-clause example; done means the array expands to the shown number of placeholders while its values remain bound safely.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, node.js, typescript
- Domain
- database
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100