Git Product home page Git Product logo

Comments (3)

mscdex avatar mscdex commented on July 17, 2024

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.

felixge avatar felixge commented on July 17, 2024

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.

felixge avatar felixge commented on July 17, 2024

Ok, that was a silly bug in the parser. Fixed in 94ce814

from mysql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.