Code Monkey home page Code Monkey logo

Comments (10)

pmjones avatar pmjones commented on August 23, 2024

From what I remember about the rebuilder, it counts the number of quotes, and looks for closing sets of quotes. That might be the culprit here.

A workaround would be to use placeholders for the blank values ...

UPDATE table SET `value`=:value, `blank`= :blank, `value2` = :value2, `blank2` = :blank2, `value3`=:value3 WHERE id = :id

... and then to pass blank '' values in the array for those placeholders.

That's a workaround for the interim.

The str_replace() solution presumes that there are no occurrences of _NULL_ in other literals in the SQL string, which may not be true; in those cases, the query might be modified in unexpected ways. Probably not something that can be added to the library as-is.

However, if you can submit a failing test in a PR, I or someone else can eventually get around to working on the regex.

How does all that sound?

from aura.sql.

harikt avatar harikt commented on August 23, 2024

I was also thinking to write what @pmjones suggested passing placeholders.

from aura.sql.

M1ke avatar M1ke commented on August 23, 2024

Are there any tests for the regex at present? The issue is that I can't be certain what it's meant to detect or not detect as I don't understand the whole syntax at present, or what the goal is.

from aura.sql.

harikt avatar harikt commented on August 23, 2024

@M1ke I think there is no tests for regular expression itself. Don't know / remember what was the decision to extract it. But it happened in 2.1.0. iirc it was something with the place holder issues I guess.

from aura.sql.

nyamsprod avatar nyamsprod commented on August 23, 2024

Another workaround is to change your request and to have a newline between conditions:

UPDATE table SET 
    `value`=:value, 
    `blank`='',
    `value2` = :value2,
    `blank2` = '',
    `value3`=:value3
WHERE id = :id

This will even have the side effect of rendering you SQL query more readable. We bumped into this bug too at work and that's the workaround we choose to implement

from aura.sql.

harikt avatar harikt commented on August 23, 2024

@nyamsprod great! .

Thank you for the patch.

from aura.sql.

frederikbosch avatar frederikbosch commented on August 23, 2024

Is this bug not also related to #104 and #108? In other words: when merging 108, this should be fixed, right?

from aura.sql.

pmjones avatar pmjones commented on August 23, 2024

Note to self: add a test for this against #134 after it merges.

from aura.sql.

pmjones avatar pmjones commented on August 23, 2024

#134 is obviated; write a test for this against #138 .

from aura.sql.

pmjones avatar pmjones commented on August 23, 2024

This appears to be fixed by #138. Thanks for the report!

from aura.sql.

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.