Giter Site home page Giter Site logo

Comments (3)

griffio avatar griffio commented on July 4, 2024

🗞️ This is related to issue #4578
Where the rows affected is not exposed(intentionally) from the driver (jdbc) implementation - so only Unit is returned.

The changes function is built into Sqlite, so won't work for other databases

As you mentioned, Postgresql can't use Returning with an aggregate function e.g RETURNING COUNT(*)

For SqlDelight, you can use a CTE like this for your query

delete:
WITH deleted_rows AS (
    DELETE FROM MyTable RETURNING *
)
SELECT COUNT(*) FROM deleted_rows;

Generates a query that returns the rows deleted

    val count = sample.testQueries.delete().executeAsOne()

from sqldelight.

msiddiqui24 avatar msiddiqui24 commented on July 4, 2024

this did not work for me, it does not successfully delete

from sqldelight.

griffio avatar griffio commented on July 4, 2024

🤔 I am not sure why that doesn't work

However, I can only provide a fully working Postgresql example https://github.com/griffio/sqldelight-postgres-example

e.g https://github.com/griffio/sqldelight-postgres-example/blob/master/src/main/sqldelight/griffio/queries/City.sq

See if that helps to solve issue

from sqldelight.

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.