sidorares / sidorares/node-mysql2
Documentation example for Pool Connections syntax is incorrect - please remedy
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.4k
- Forks
- 680
- Avg merge
- 9h 7m
- Merged PRs (30d)
- 59
Description
I think it might very helpful for adopters who refer to the documentation for examples on proper syntax when using pooled connections, I have noticed that it is incorrect and thought I might have been doing something wrong.
It currently shows the sample for auto-connect and auto-release syntax when using connection pools as:
// For pool initialization, see above
pool.query(function(err, conn) {
conn.query(/* ... */);
// Connection is automatically released when query resolves
})
It should be as follows, no?
// For pool initialization, see above
pool.query(function(err, conn) {
// Connection is automatically released when query resolves
})
I have tried my suggested version without issue, but could not get the included example in the documentation to work as advertised. It returns:
events.js:183
throw er; // Unhandled 'error' event
^Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Can someone responsible for the documenation on both npmjs.com and here on the wiki for mysql2 here on Github make the correction please. I think it may cause alot of consternation for first-time users.
Thanks!
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
Inspect the pooled-connection example referenced in the npmjs.com documentation and the GitHub wiki, then compare it with the working and failing snippets in the issue. Update the example in both locations to show the intended pool.query usage, and verify that the documented example no longer triggers the reported empty-SQL error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, nodejs
- Domain
- databases, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100