Code Monkey home page Code Monkey logo

Comments (5)

jnbarlow avatar jnbarlow commented on May 20, 2024

So, it turns out that if you have NO_BACKSLASH_ESCAPE turned on, this errors shows up. The MySQL driver automatically escapes strings, so all the double quotes in the JSON string are being escaped. It wasn't noticed before because MySQL was ignoring the backslashes, but I think the auto-escaping of JSON is more the issue. I've suggested to the maintainers of the MySQL driver to try to detect if the string is JSON first before escaping.

from express-mysql-session.

jnbarlow avatar jnbarlow commented on May 20, 2024

Alternatively, updating the query to concat the JSON string directly in would be another way around the problem.

from express-mysql-session.

chill117 avatar chill117 commented on May 20, 2024

I don't think the issue you're experiencing should be handled within this module. It uses JSON.stringify() to create a string from the session data before inserting it into the database. This module uses node-mysql module internally for creating MySQL connections. All the options you pass to the new SessionStore(options) constructor are also passed thru to the node-mysql module. So if you need to pass options to it for how to handle string data when inserting it into the database, you can do that.

Hope this helps!

from express-mysql-session.

jnbarlow avatar jnbarlow commented on May 20, 2024

Yeah, the node-mysql people are going to put the NO_BACKSLASH_ESCAPE as a known issue :)

from express-mysql-session.

chill117 avatar chill117 commented on May 20, 2024

Great. Glad things got sorted out for you :)

from express-mysql-session.

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.