Giter Club home page Giter Club logo

Comments (6)

ianpartridge avatar ianpartridge commented on May 29, 2024

Similarly:

Select(from: t).group(by: t.a, t.b).having(Parameter().in(Parameter(), Parameter()))

is generating:

SELECT * FROM tableSubquery GROUP BY tableSubquery.a, tableSubquery.b HAVING ?1 IN (?2, ?3)

which is returning no rows (instead of 6, as the test expects).

from swift-kuery.

irar2 avatar irar2 commented on May 29, 2024
SELECT * FROM tableSubquery GROUP BY tableSubquery.a, tableSubquery.b HAVING ?1 IN (?2, ?3)

is actually

SELECT * FROM tableSubquery GROUP BY tableSubquery.a, tableSubquery.b HAVING true IN (true, false)

and it looks like SQLite doesn't have boolean values. I'll add this to QueryBuilder.

from swift-kuery.

irar2 avatar irar2 commented on May 29, 2024
SELECT * FROM tableSubquery WHERE -7 IN (SELECT tableSubquery.b FROM tableSubquery WHERE tableSubquery.b = -1)

should return an empty result. Does SQLite always return nil instead of empty result? If so, we just need to change the tests.

I'm confused though, because as far as I can see the subquery should return no rows because t.b is never -1?

Yes, the subquery should return no rows, as well as the query, and the expected number of rows is 0. Posgres returns an empty result as expected.

from swift-kuery.

irar2 avatar irar2 commented on May 29, 2024

@ianpartridge Please change the tests in TestSubquery from:

s = Select(from: t).group(by: t.a, t.b).having(Parameter().in(Parameter(), Parameter()))   
executeQueryWithParameters(query: s, connection: connection, parameters: true, true, false) { 
...

s = Select(from: t).where(false.notIn(Parameter(), Parameter())) 
executeQueryWithParameters(query: s, connection: connection, parameters: true, true) {       

to

s = Select(from: t).group(by: t.a, t.b).having(Parameter().in(Parameter(), Parameter())) 
executeQueryWithParameters(query: s, connection: connection, parameters: 1, 1, 0) { 
...

s = Select(from: t).where(false.notIn(Parameter(), Parameter())) 
executeQueryWithParameters(query: s, connection: connection, parameters: 1, 1) {       

Here we pass booleans as parameters, and SQLite tests should use 1/0 instead of true/false.

from swift-kuery.

ianpartridge avatar ianpartridge commented on May 29, 2024

Ah, the SQLite driver doesn't support parameters at the moment. I haven't worked out whether that's a limitation of SQLite or the driver.

from swift-kuery.

irar2 avatar irar2 commented on May 29, 2024

Fixed

from swift-kuery.

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.