[jOOQ/jOOQ#13104] Reimplement SQL Server RETURNING emulation using

QueryPart. instead of SchemaMapping
This commit is contained in:
Lukas Eder 2022-02-18 12:58:54 +01:00
parent 72a0010df5
commit 84d98e8dfa
3 changed files with 11 additions and 30 deletions

View File

@ -89,6 +89,8 @@ import static org.jooq.impl.Keywords.K_ROWCOUNT;
import static org.jooq.impl.Keywords.K_SELECT;
import static org.jooq.impl.Keywords.K_SQL;
import static org.jooq.impl.Keywords.K_TABLE;
import static org.jooq.impl.Names.N_DELETED;
import static org.jooq.impl.Names.N_INSERTED;
import static org.jooq.impl.Tools.EMPTY_FIELD;
import static org.jooq.impl.Tools.EMPTY_STRING;
import static org.jooq.impl.Tools.anyMatch;
@ -805,6 +807,7 @@ abstract class AbstractDMLQuery<R extends Record> extends AbstractRowCountQuery
final void toSQLReturning(Context<?> ctx) {

View File

@ -157,6 +157,7 @@ final class Names {
static final Name N_IFNULL = systemName("ifnull");
static final Name N_IIF = systemName("iif");
static final Name N_INSERT = systemName("insert");
static final Name N_INSERTED = systemName("inserted");
static final Name N_INSTR = systemName("instr");
static final Name N_ISJSON = systemName("isjson");
static final Name N_JOIN = systemName("join");
@ -361,6 +362,7 @@ final class Names {
static final Name N_CURRENT_USER = systemName("current_user");
static final Name N_DATE_ADD = systemName("date_add");
static final Name N_DEGREES = systemName("degrees");
static final Name N_DELETED = systemName("deleted");
static final Name N_DELETING = systemName("deleting");
static final Name N_DIGITS = systemName("digits");
static final Name N_E = systemName("e");

View File

@ -706,12 +706,6 @@ final class Tools {
* statement.
*/
DATA_SELECT_ALIASES,
/**
* [#8917] An internal schema mapping that overrides any user-defined
* schema mappings.
*/
DATA_SCHEMA_MAPPING,
}
/**
@ -3201,14 +3195,8 @@ final class Tools {
* Map a {@link Catalog} according to the configured {@link org.jooq.SchemaMapping}
*/
static final Catalog getMappedCatalog(Scope scope, Catalog catalog) {
if (scope != null) {
org.jooq.SchemaMapping mapping = (SchemaMapping) scope.data(DataKey.DATA_SCHEMA_MAPPING);
if (mapping == null)
mapping = scope.configuration().schemaMapping();
return mapping.map(catalog);
}
if (scope != null)
scope.configuration().schemaMapping().map(catalog);
return catalog;
}
@ -3217,14 +3205,8 @@ final class Tools {
* Map a {@link Schema} according to the configured {@link org.jooq.SchemaMapping}
*/
static final Schema getMappedSchema(Scope scope, Schema schema) {
if (scope != null) {
org.jooq.SchemaMapping mapping = (SchemaMapping) scope.data(DataKey.DATA_SCHEMA_MAPPING);
if (mapping == null)
mapping = scope.configuration().schemaMapping();
return mapping.map(schema);
}
if (scope != null)
return scope.configuration().schemaMapping().map(schema);
return schema;
}
@ -3233,14 +3215,8 @@ final class Tools {
* Map a {@link Table} according to the configured {@link org.jooq.SchemaMapping}
*/
static final <R extends Record> Table<R> getMappedTable(Scope scope, Table<R> table) {
if (scope != null) {
org.jooq.SchemaMapping mapping = (SchemaMapping) scope.data(DataKey.DATA_SCHEMA_MAPPING);
if (mapping == null)
mapping = scope.configuration().schemaMapping();
return mapping.map(table);
}
if (scope != null)
return scope.configuration().schemaMapping().map(table);
return table;
}