Giter Club home page Giter Club logo

Comments (6)

hiddentao avatar hiddentao commented on July 26, 2024

usingValuePlaceholders really only applies when using parameterized values for certain DB engines. For instance when doing an insert you would construct the query as:

squel.insert({ usingValuePlaceholders: true }).into('table').set('field', '?')

// INSERT INTO table (field) VALUES(?)

You would then use your db engine's preferred querying method to replace the ? parameter with an actual value.

from squel.

hiddentao avatar hiddentao commented on July 26, 2024

As for why squel doesn't automatically quote table names and field names it's as I mentioned in a comment: squel needs to be able to support the following:

squel.select().from("db1.table1").field("DATE_FORMAT(db1.table1.when, '%Y-%M-%D')", "Start date")

But I take your and bminer's point that it would be useful to have an option which turns on auto-quoting when you want it. I'll see if I can do that as part of #1.

from squel.

hiddentao avatar hiddentao commented on July 26, 2024

As for the WHERE clause generation not working in your above code I ran it myself against squel 1.0.5 and got the following output:

SELECT "color", "size", "childSku", "Variants"."updatedAt", "listPriceCents", "salePriceCents", "ProductId", "Products"."parentSku", "Products"."title", "Products"."description", "Products"."CategoryId", "Categories"."name", "Categories"."description", "Products"."BrandId", "Brands"."name", "Brands"."description", "Brands"."PartnerId", "Partners"."name" FROM "Variants" LEFT JOIN "Products" ON ("Variants"."ProductId" = "Products"."id") LEFT JOIN "Categories" ON ("Products"."CategoryId" = "Categories"."id") LEFT JOIN "Brands" ON ("Products"."BrandId" = "Brands"."id") LEFT JOIN "Partners" ON ("Brands"."PartnerId" = "Brands"."PartnerId") WHERE (`Variants`.`childSku` = 'puma-1234-red-large')

from squel.

hiddentao avatar hiddentao commented on July 26, 2024

Version 1.0.6 has two new options:

autoQuoteTableNames
autoQuoteFieldNames

Note: you will still need to add your own quotes around names inside where clauses, etc.

from squel.

hiddentao avatar hiddentao commented on July 26, 2024

Am considering this done for now.

from squel.

dankohn avatar dankohn commented on July 26, 2024

Yep, thanks for resolving!

from squel.

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.