我在下面有一个长select语句,当我运行它时,我在节点服务器上收到的错误数据太长,但是当我将它复制粘贴到mysql workbench时,它工作正常。我如何着手解决这个问题?
SELECT `199_roster`.`first`, `199_roster`.`last`, `199_roster`.`gender`, `199_roster`.`grade`, `199_results`.`ath_id`, `199_results`.`place`, `199_results`.`date`, `199_results`.`comment`, `199_results`.`100m Hurdles (F)`, `199_results`.`110m Hurdles (M)`, `199_results`.`100m Dash (F)`, `199_results`.`100m Dash (M)`, `199_results`.`1600m Run (F)`, `199_results`.`1600m Run (M)`, `199_results`.`4x100m Relay (F)`, `199_results`.`4x100m Relay (M)`, `199_results`.`400m Dash (F)`, `199_results`.`400m Dash (M)`, `199_results`.`200m Hurdles (F)`, `199_results`.`200m Hurdles (M)`, `199_results`.`800m Run (F)`, `199_results`.`800m Run (M)`, `199_results`.`200m Dash (F)`, `199_results`.`200m Dash (M)`, `199_results`.`4x400m Relay (F)`, `199_results`.`4x400m Relay (M)`, `199_results`.`High Jump (F)`, `199_results`.`High Jump (M)`, `199_results`.`Long Jump (F)`, `199_results`.`Long Jump (M)`, `199_results`.`Shot Put (F)`, `199_results`.`Shot Put (M)`, `199_results`.`Discus (F)`, `199_results`.`Discus (M)`, `199_results`.`Pole Vault (F)`, `199_results`.`Pole Vault (M)`, `199_results`.`3200m Run (M)`, `199_results`.`3200m Run (F)`, `199_results`.`300m Hurdles (M)`, `199_results`.`300m Hurdles (F)`, `199_results`.`4x800m Relay (M)`, `199_results`.`4x800m Relay (F)`, `199_results`.`100m Hurd. Trial (F)`, `199_results`.`110m Hurd. Trial (M)`, `199_results`.`100m Dash Trial (F)`, `199_results`.`100m Dash Trial (M)`, `199_results`.`200m Dash Trial (F)`, `199_results`.`200m Dash Trial (M)`, `199_results`.`400m Hurdles (F)`, `199_results`.`400m Hurdles (M)`, `199_results`.`2000m Steeplechase (F)`, `199_results`.`2000m Steeplechase (M)`, `199_results`.`3000m Steeplechase (F)`, `199_results`.`3000m Steeplechase (M)`, `199_results`.`1500m Run (F)`, `199_results`.`1500m Run (M)`, `199_results`.`3000m Run (F)`, `199_results`.`3000m Run (M)`, `199_results`.`5000m Run (F)`, `199_results`.`5000m Run (M)`, `199_results`.`10000m Run (F)`, `199_results`.`10000m Run (M)`, `199_results`.`Triple Jump (F)`, `199_results`.`Triple Jump (M)`, `199_results`.`Hammer Throw (F)`, `199_results`.`Hammer Throw (M)`, `199_results`.`Javelin Throw (F)`, `199_results`.`Javelin Throw (M)`, `199_results`.`Distance Medley Relay (F)`, `199_results`.`Distance Medley Relay (M)`, `199_results`.`Sprint Medley Relay (F)`, `199_results`.`Sprint Medley Relay (M)`, `199_results`.`4x200m Relay (F)`, `199_results`.`4x200m Relay (M)`, `199_results`.`4x1500m Relay (F)`, `199_results`.`4x1500m Relay (M)`, `199_results`.`4x1600m Relay (F)`, `199_results`.`4x1600m Relay (M)`, `199_results`.`Shuttle Hurdle Relay (F)`, `199_results`.`Shuttle Hurdle Relay (M)`, `199_results`.`60m Dash Trial (F)`, `199_results`.`60m Dash Trial (M)`, `199_results`.`60m Dash (F)`, `199_results`.`60m Dash (M)`, `199_results`.`60m Hurd. Trial (F)`, `199_results`.`60m Hurd. Trial (M)`, `199_results`.`60m Hurdles (F)`, `199_results`.`60m Hurdles (M)`, `199_results`.`50m Dash Trial (F)`, `199_results`.`50m Dash Trial (M)`, `199_results`.`50m Dash (F)`, `199_results`.`50m Dash (M)`, `199_results`.`50m Hurd. Trial (F)`, `199_results`.`50m Hurd. Trial (M)`, `199_results`.`50m Hurdles (F)`, `199_results`.`50m Hurdles (M)`, `199_results`.`55m Dash Trial (F)`, `199_results`.`55m Dash Trial (M)`, `199_results`.`55m Dash (F)`, `199_results`.`55m Dash (M)`, `199_results`.`55m Hurd. Trial (F)`, `199_results`.`55m Hurd. Trial (M)`, `199_results`.`55m Hurdles (F)`, `199_results`.`55m Hurdles (M)`, `199_results`.`100y Dash (F)`, `199_results`.`100y Dash (M)`, `199_results`.`Mile Run (F)`, `199_results`.`Mile Run (M)` FROM `199_results` INNER JOIN `199_roster` ON `199_roster`.`ath_id` = `199_results`.`ath_id` WHERE `199_results`.`date` BETWEEN '2018-04-01 00:00:01' AND '2018-05-08 23:59:59';
这是我在.js文件中进行查询的部分(通常我在客户端创建查询并动态发送,但是为了调试,我将变量设置如下)
var fullQuery = "SELECT * FROM `199_results` INNER JOIN `199_roster` ON `199_roster`.`ath_id` = `199_results`.`ath_id` WHERE `199_results`.`date` BETWEEN '2018-04-01 00:00:01' AND '2018-05-08 23:59:59';"
const db = require("../db");
db.query(fullQuery, (err, rows, fields) => {
if (err) {
res.render("results", {
title: "Results",
mysqlError: err.message
})
return console.error('stupid error', err)
} else {
req.session.results = rows;
res.send(rows)
}
})
下面是错误消息中的更多信息,如果有帮助的话:
错误:er\u data \u too \u long:query.sequence第1行'data'列的数据太长。\u packettoerror(/root/site/node\u modules/mysql/lib/protocol/sequences/sequence.js:52:14)at query.errorpacket(/root/site/node\u modules/mysql/lib/protocol/sequences/q uery.js:77:18)at protocol。\u parsepacket(/root/site/node\u modules/mysql/lib/protocol/protocol、 js:279:23)在parser.write(/root/site/node\u modules/mysql/lib/protocol/parser.js:76:12)在protocol.write(/root/site/node\u modules/mysql/lib/protocol/protocol.js:39:16)在socket(/root/site/node\u modules/mysql/lib/connection.js:103:2 8)在emitone(events.js:116:13)在socket.emit(events.js:211:7)在addchunk(\u stream\u readable.js:263:12)在readableaddchunk(\u stream\u readable.js:250:11)
3条答案
按热度按时间cigdeys31#
这个问题似乎是一个节点异步问题(我应该早点意识到这一点)。
通过评论
现在一切正常,没有错误,一切显示正确。michaelsqlbot认为这不是一个查询错误是正确的,如果我有足够的代表可以这样做的话,我会投更多的票。
qv7cva1a2#
---------在pool.query(/root/site/node\u modules/mysql/lib/pool.js:199:23)在mysqlstore.set(/root/site/node\u modules/express mysql session/index.js:19 9:19)在session.save(/root/site/node\u modules/express session/session/session.js:72:25)在session.save(/root/site/node\u modules/express session/index.js:381:15)在serverresponse.end(/root/site/node\u modules/express session/index.js:330:21)在serverresponse.send(/root/site/node_modules/express/lib/response.js:221:10)在serverresponse.json(/root/site/node_modules/express/lib/response.js:267:15)在serverresponse.send(/root/site/node_modules/express/lib/response.js:158:21)在query.db.query[ascallback](/root/site/routes/resultsrouter.js:184:9)在query.sequence.end(/root/site/node\u modules/mysql/lib/protocol/sequences/sequence.js:88:24)
ejk8hzay3#
既然你正在检索这么多的数据,你能不能