sidorares / sidorares/node-mysql2

namedPlaceholders within sql comment

Open
#776 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
4.4k
Forks
680
Avg merge
9h 7m
Merged PRs (30d)
59

Description

As currently written, the namedPlaceholders parser detects placeholder names within sql comments. This could lead to them being processed out of order. The example query below would result in a params array from the named-placeholders package of [ <active_value_here>, <id_value_here>, <active_value_here> ] rather than the expected ordering. I'm guessing that having too many params would likely be ignored, but having them out of order is decidedly a bigger problem.

Example:

SELECT * FROM /:active param here should be ignored/ user WHERE user.id = :id AND active = :active

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the namedPlaceholders parser used by node-mysql2 and reproduce the SQL example from the issue. The parser should ignore the placeholder-like text inside the SQL comment while preserving the expected parameter ordering for :id and :active.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, node.js, typescript
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.