Introduce generatedKey() on SqlResult
See original GitHub issueFor PostgreSQL we can use RETURNING
clause for fetching the generated keys, but in MySQL we can get the generated key via the last_insert_id
in the OK_Packet OTTB, so we may add an interface for this in the sqlclient
module for better usage.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
The <generatedKey> Element - MyBatis Generator Core
The <generatedKey> element is used to specify properties for auto generated keys (from identity field or sequences).
Read more >coldfusion - Missing GENERATEDKEY from Query Result
But I am just trying to determine why current code stopped working. I believed that generatedkey will always be returned for sql server...
Read more >cfquery - Adobe Support
ColdFusion 9.0.1: Introduced support for HQL queries; added the attribute {{ormoptions. ... GENERATEDKEY, Supports all databases.
Read more >SQL Server Choose() function introduction and examples
Example 1: SQL Server CHOOSE() function with literal values. In this example, we use choose() function to return values from different index ...
Read more >4. Spark SQL and DataFrames: Introduction to Built-in Data ...
To issue any SQL query, use the sql() method on the SparkSession instance, spark , such as spark.sql("SELECT * FROM myTableName") . All...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am worried that each database will have its peculiarities
Perhaps we can add notion of properties on
SqlResult
, to do something likeresult.property("lastInsertId")
?we could also do the same using generics magic to avoid casting and expose constants with something like:
I agree we should avoid magic like injecting
RETURNING
clause into the SQL statement.Since we use the same interface to represent the result as
SqlResult
, what I mean is adding alastInsertId()
method to theSqlResult
interface.UnsupportedOperation
and give a hint to the users that they should writeRETURNING
SQL by themselves.