Giter Club home page Giter Club logo

Comments (6)

kilnerm avatar kilnerm commented on June 26, 2024

@richardpauljones, Sorry it's taken so long to get back to you on this.

Can you help me understand what values are being returned in these cases? I am trying to work out whether there is similar function in the existing plugins.

from swift-kuery.

richardpauljones avatar richardpauljones commented on June 26, 2024

So the normal behaviour of SQL server for an insert/update/delete is just to return the number of rows affected. This is different in PostgreSQL, where the default behaviour is to return the record you have just inserted/updated/deleted.

To get the same behaviour you need to added the OUTPUT statement as I have shown in my examples above.

I found this issue while trying to run the PostgreSQL test project against my experimental ODBC database driver. The test that breaks is func testInsertID() {

from swift-kuery.

kilnerm avatar kilnerm commented on June 26, 2024

I believe the default behavior in PostgreSQL is to just return the number of rows affected. In the case where you are doing an insert and have the returnID property set to true then the buildQuery function in PostgreSQLConnection will add a suffix to the built query to indicate we want the id column returning.

If the positioning of the OUTPUT clause is not important I would suggest mirroring this approach in your plugin.

If the positioning is important then it becomes a little more difficult. You could either patch the clause into the built query or perhaps implement a build method that accepts the query instance and generates the desired output.

from swift-kuery.

richardpauljones avatar richardpauljones commented on June 26, 2024

Thanks for that.

Yes the positioning of the Output statement is important.

from swift-kuery.

kilnerm avatar kilnerm commented on June 26, 2024

@richardpauljones Do you require any further assistance on this issue?

from swift-kuery.

kilnerm avatar kilnerm commented on June 26, 2024

I am going to mark this issue as closed. If you require anything further please reopen.

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.