Comments (3)
I've reproduced this same issue. It does indeed happen when you perform two or more SELECTs using the same database connection. This bug is quite the showstopper :-(
It seems that FIELD_PACKET is not being emitted for subsequent SELECT queries. From my testing, it is instead receiving 4 ROW_DATA_PACKET events followed by 1 EOF_PACKET, 1 ROW_DATA_PACKET (this is the actual row in the table i'm assuming), and then 1 EOF_PACKET.
For my example I have a database called 'testdb' and two tables, 'foo' and 'bar'. Querying 'foo' (SELECT * FROM foo)works as expected, but querying 'bar' (SELECT * FROM bar) does not. The 'bar' table contains two fields: 'myid' and 'mytitle'.
I've found if I place this code right inside the beginning of the Parser.ROW_DATA_PACKET case in query.js, I am able to see the one row in the 'bar' table in the query results:
if (!this._fields) {
this._fields = ['myid', 'mytitle'];
}
With this modification, the query results contains:
[ { myid: 'def', mytitle: 'testdbbar', undefined: '' }
, { myid: 'def', mytitle: 'testdbbar', undefined: '' }
, { myid: '1', mytitle: 'Hello from bar' }
]
Hopefully this helps narrow down the problem some. I tried to find the root cause, but I am not well versed enough in the MySQL protocol to find it and this was as close as I could get to getting the actual row(s) back from the second SELECT query.
from mysql.
I'm looking into this myself right now, it's just as you describe. I added a new debug mode for the client along with a failing test case. The output is:
<- GREETING_PACKET: {"length":52,"received":52,"number":0,"type":0,"protocolVersion":10,"serverVersion":"5.1.46","threadId":4841,"scrambleBuffer":{"0":113,"1":44,"2":33,"3":97,"4":70,"5":119,"6":73,"7":70,"8":97,"9":56,"10":49,"11":47,"12":55,"13":99,"14":111,"15":39,"16":111,"17":121,"18":54,"19":64,"length":20},"serverCapabilities":63487,"serverLanguage":192,"serverStatus":2}
-> <Buffer 3b 00 00 01 cf f7 03 00 00 00 00 01 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 72 6f 6f 74 00 14 da b4 5f 0b 16 2d 2d a6 d3 66 5a 01 7e 07 7a 16 fb 09 5c be 00>
<- OK_PACKET: {"length":7,"received":7,"number":2,"type":1,"affectedRows":0,"insertId":0,"serverStatus":2,"message":"\u0000\u0000"}
-> <Buffer 22 00 00 00 03 53 45 4c 45 43 54 20 31 20 61 73 20 66 69 65 6c 64 5f 61 2c 20 32 20 61 73 20 66 69 65 6c 64 5f 62>
<- RESULT_SET_HEADER_PACKET: {"length":1,"received":1,"number":1,"type":3,"fieldCount":2}
<- FIELD_PACKET: {"length":29,"received":29,"number":2,"type":4,"catalog":"def","name":"field_a","charsetNumber":63,"fieldLength":1,"fieldType":8,"flags":129,"decimals":0}
<- FIELD_PACKET: {"length":29,"received":29,"number":3,"type":4,"catalog":"def","name":"field_b","charsetNumber":63,"fieldLength":1,"fieldType":8,"flags":129,"decimals":0}
<- EOF_PACKET: {"length":5,"received":5,"number":4,"type":5,"warningCount":0,"serverStatus":2}
<- ROW_DATA_PACKET: {"index":0,"length":4,"received":1,"number":5,"columnLength":0,"type":6}
<- EOF_PACKET: {"length":5,"received":5,"number":6,"columnLength":0,"type":5,"warningCount":0,"serverStatus":2}
-> <Buffer 14 00 00 00 03 53 45 4c 45 43 54 20 33 20 61 73 20 66 69 65 6c 64 5f 63>
<- ROW_DATA_PACKET: {"index":0,"length":1,"received":1,"number":1,"columnLength":0,"type":6}
This looks really weird, but I'll let you know once I found out what is going on.
from mysql.
Ok, that was a silly bug in the parser. Fixed in 94ce814
from mysql.
Related Issues (20)
- 腾讯云系统centos7.2安装mysql失败,怎么办麽、 HOT 1
- Error connecting to Aurora DB using the "Amazon RDS" profile HOT 4
- mysql.createPool transaction with loop HOT 1
- Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client HOT 1
- How to catch ER_BAD_FIELD_ERROR HOT 2
- Missing information in Documentation HOT 1
- Multiple insert using array notation HOT 1
- Uncaught exception for "Connection lost: The server closed the connection." HOT 3
- Node 17.4, MySQL Server 8.0, Mac OS Monterey, ECONNREFUSED with error code -61, ::1:3306 HOT 5
- breaks scope HOT 3
- Supported MySQL Versions HOT 2
- readable stream does not seem to support readableLength property HOT 14
- Question - Get query of row HOT 2
- Write cluster failover, pool stuck with read-only cluster HOT 1
- The correct table name when creating the table, with an error: ER_WRONG_TABLE_NAME. HOT 4
- Better type casting of BIT values HOT 3
- the connection string is parsed wrongly HOT 1
- Updating URL parsing to WHATWG URL HOT 2
- RangeError: The value of "offset" is out of range. It must be >= 0 and <= 5254. Received 5261
- getConnection always get timed out
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mysql.