louislam / louislam/redbean-node
Ошибка в форматировании запроса
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 33
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
const admins = await R.findAll('users', 'server_number = ? AND admin_level >= ?', [user.server_number, 1]);
Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server
at Sequence._packetToError (/VKBot/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
at Query.ErrorPacket (/VKBot/node_modules/mysql/lib/protocol/sequences/Query.js:79:18)
at Protocol._parsePacket (/VKBot/node_modules/mysql/lib/protocol/Protocol.js:291:23)
at Parser._parsePacket (/VKBot/node_modules/mysql/lib/protocol/Parser.js:433:10)
at Parser.write (/VKBot/node_modules/mysql/lib/protocol/Parser.js:43:10)
at Protocol.write (/VKBot/node_modules/mysql/lib/protocol/Protocol.js:38:16)
at Socket.<anonymous> (/VKBot/node_modules/mysql/lib/Connection.js:88:28)
at Socket.<anonymous> (/VKBot/node_modules/mysql/lib/Connection.js:526:10)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:559:12)
--------------------
at Protocol._enqueue (/VKBot/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Connection.query (/VKBot/node_modules/mysql/lib/Connection.js:198:25)
at /VKBot/node_modules/knex/lib/dialects/mysql/index.js:132:18
at new Promise (<anonymous>)
at Client_MySQL._query (/VKBot/node_modules/knex/lib/dialects/mysql/index.js:126:12)
at executeQuery (/VKBot/node_modules/knex/lib/execution/internal/query-executioner.js:37:17)
at Client_MySQL.query (/VKBot/node_modules/knex/lib/client.js:146:12)
at Runner.query (/VKBot/node_modules/knex/lib/execution/runner.js:123:36)
at ensureConnectionCallback (/VKBot/node_modules/knex/lib/execution/internal/ensure-connection-callback.js:13:17)
at Runner.ensureConnection (/VKBot/node_modules/knex/lib/execution/runner.js:300:20) {
code: 'ER_PARSE_ERROR',
errno: 1064,
sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version
sqlState: '42000',
index: 0,
sql: 'select * from users where 1=1 server_number = 1 AND admin_level >= 1'
Contributor guide
No contributing guide indexed for this repository
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 at the R.findAll call shown in the issue and inspect the query-building path that produces the displayed SQL. Reproduce the call against MariaDB, then verify that the generated query is valid and no longer raises ER_PARSE_ERROR.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mariadb, 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
- 45/100