Code Monkey home page Code Monkey logo

Comments (6)

ahmad-moussawi avatar ahmad-moussawi commented on May 20, 2024

Thanks for reporting, yes currently these cases are not supported in DELETE, INSERT and UPDATE statements, the main reason is that the join method is not supported in all db engines, for example in Postgres, so don't know what is the best way to handle this, maybe we can:

  1. converting the join to a CTE or subquery (while I don't recommend such implicit conversion)
  2. or throw an exception to the user for the unsupported engines
  3. or compile it and let the user handle these cases
    4 or ignore it at all (current)

What do you think ?

from querybuilder.

ahmad-moussawi avatar ahmad-moussawi commented on May 20, 2024

for the moment, I agree that we should mention this in the docs, could you open an issue there please, or I do it myself ?

from querybuilder.

ceastwood avatar ceastwood commented on May 20, 2024

I will open the issue there later if I don't see it already.

Yeah, I don't think making the implicit conversion is the way to go--I was just looking up the USING statement in postgres but I'd have to come back to that.

In a local dev branch, I've started to build onto the UPDATE/INSERT for sqlserver compiler as well as add tests. I think since the library already just ignores the unsupported statement it can stay that way until someone finds a reason not to silently ignore it.

from querybuilder.

punssoma avatar punssoma commented on May 20, 2024

Any updates on adding join to insert/update/delete. Eagerly waiting for it. Was looking for a solution for SQLServer.

from querybuilder.

ahmad-moussawi avatar ahmad-moussawi commented on May 20, 2024

@punssoma
Do you have a proposal on how this can be accomplished in the following database:

  • Sql Server
  • MySql
  • PostgreSql

for the time being I suggest using subqueries something like

// delete the books where with AuthorId = 1
db.Query("Books").WhereIn("Id", q => q.From("Books").Join("Authors").Where("Authors.Id", 1).Select("Id"))

from querybuilder.

punssoma avatar punssoma commented on May 20, 2024

@ahmad-moussawi Thanks for the tip.
No proposal as of now. Let me try something locally and then may be i can suggest

from querybuilder.

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.