Git Product home page Git Product logo

Comments (5)

felixge avatar felixge commented on July 17, 2024

I've done some initial investigation and this seems to be a problem related to packet ordering. A temporary workaround is to use setTimeout(..., 500) in your select query and things will work as expected.

I'm looking into this now, it needs a proper fix in my module. It's still confusing why this particular example seems to trigger the problem while I've not seen it show up in any other test cases nor in production.

from mysql.

felixge avatar felixge commented on July 17, 2024

Ok, I have a better workaround. The problem is that you are executing two queries at once in your initial create table sql block and mysql is sending two ok packets for that. However, my client only expects on response so things go bad.

So all that is needed on your end is to make sure you don't issue several queries at once using a semicolon. This really shouldn't be a big problem in your code since all queries are queued by default anyway.

Nevertheless I think I'll try to add support for multiple queries within one query call.

--fg

from mysql.

rentzsch avatar rentzsch commented on July 17, 2024

Hi Felix,

Thanks for delving into this one! Separating statements is no biggie, so I'll just do that.

P.S. I know from experience splitting SQL statements is no walk in the park thanks to complicated escaping rules. Plan accordingly :-)

-jwr

from mysql.

felixge avatar felixge commented on July 17, 2024

Well, I'm not planning to analyze the sql string for multiple queries - that's asking for trouble. MySql gives every packet a number, and it is reset for each query (where combined queries are combined), so it would be possible to detect if one query is receiving more than one response.

For simple queries (INSERT, etc.), I could simply call the callback multiple times, but I'm not sure how to handle multiple selects (they need two query objects).

Before compromising on a leaky abstraction I'd probably throw an error if more than one response is received per query.

Will keep you posted.

from mysql.

rentzsch avatar rentzsch commented on July 17, 2024

Ah, cool. Thanks for the insight.

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.