sidorares / sidorares/node-mysql2

execute/query from json like tokenized params

Open
#831 5 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

do we have feature like this ? i am unable to get it work using mysql2

pool.query( 'SELECT * FROM tablename WHERE col1 = :pid AND col2 = :tid', {pid:5, tid:6} )
.then((rs)=>{console.log(rs)})
.catch((e)=>{console.log(e)})

this gives error.... i have tried pool.execute() as well but no luck.

of-course i can build the query manually by doing a string replace and escape params etc.
but i thought this is a basic feature. and i am aware of features like using the "?", but i need it this way.

could not find this kinda examples in the doc, which uses named placeholders.

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 request concerns pool.query and pool.execute with :pid and :tid named placeholders. Start by checking the query/execute API documentation and existing placeholder-handling tests; done means either documented named-parameter behavior with a passing example or a clearly stated unsupported limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, nodejs, typescript
Domain
database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.