sidorares / sidorares/node-mysql2

only resolve named placeholders if values is an object

Open
#217 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Would it be an idea, to only resolve named placeholders for options.sql when type of options.values is an object.

The problem is, that I can not set namedPlaceholder: true in the general config, and then execute a query like: conn.execute('SELECT * FROM items WHERE id = ?;', [ id ]);

I think the namedPlaceholders config should simply be to allow for named placeholders, but still work with the other query methods.

If I create tests and PR, are you interested in accepting it and make a release? Or where are you in your release plans.

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

The issue does not name files or tests. Start by reproducing the positional conn.execute query with namedPlaceholders enabled and trace how options.values and placeholders are handled. Done means named placeholders still work with object values while positional queries continue to work with array values.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.