Comments (6)
@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.
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.
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.
Thanks for that.
Yes the positioning of the Output statement is important.
from swift-kuery.
@richardpauljones Do you require any further assistance on this issue?
from swift-kuery.
I am going to mark this issue as closed. If you require anything further please reopen.
from swift-kuery.
Related Issues (20)
- Does the QueryParams support 'LIKE' filter?
- Swift build wont succeed HOT 2
- Swift Build failing HOT 2
- Add support for NOW() as a default value for timestamp columns HOT 1
- Add support for triggers / ON UPDATE
- Cache built queries
- Support INSERT .. ON CONFLICT
- ConnectionPool does not expose connection errors
- Make API for retrieving results asynchronous HOT 1
- Prepare and Release SwiftKuery 3.0 HOT 1
- Kuery 3.0 migration guide HOT 1
- MySQLThreadSafeConnection on version 3.0.0 HOT 2
- Replace enum for `QueryBuilder` substitutions
- ODBC Support HOT 2
- Add reset statement for prepared statements HOT 1
- Generic created_at and updated_at for Table HOT 1
- Using in NIO EventLoopFuture chains? HOT 1
- DISTINCT doesn't seem to work with JOIN
- Parameter is not working with sub-request
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-kuery.