[jOOQ/jOOQ#8897] Fix INSERT .. RETURNING for Oracle
INSERT .. RETURNING emulation doesn't work on Oracle for single row inserts when returning expressions
This commit is contained in:
parent
b20658f262
commit
d6bf5a8fe1
@ -498,11 +498,20 @@ abstract class AbstractDMLQuery<R extends Record> extends AbstractRowCountQuery
|
||||
ctx.data().remove(DATA_DML_TARGET_TABLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* The estimated number of affected rows, {@link Integer#MAX_VALUE}, if
|
||||
* unknown.
|
||||
*/
|
||||
abstract int estimatedRowCount();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -261,8 +261,12 @@ final class DeleteQueryImpl<R extends Record> extends AbstractDMLQuery<R> implem
|
||||
return super.isExecutable();
|
||||
}
|
||||
|
||||
@Override
|
||||
final int estimatedRowCount() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -105,7 +105,11 @@ final class FieldMapsForInsert extends AbstractQueryPart {
|
||||
}
|
||||
|
||||
// Single record inserts can use the standard syntax in any dialect
|
||||
else if (rows == 1 ) {
|
||||
|
||||
|
||||
|
||||
|
||||
else if (rows == 1 ) {
|
||||
ctx.formatSeparator()
|
||||
.start(INSERT_VALUES)
|
||||
.visit(K_VALUES)
|
||||
|
||||
@ -866,13 +866,17 @@ final class InsertQueryImpl<R extends Record> extends AbstractStoreQuery<R> impl
|
||||
return insertMaps.isExecutable() || defaultValues || select != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
final int estimatedRowCount() {
|
||||
if (defaultValues)
|
||||
return 1;
|
||||
else if (select != null)
|
||||
return Integer.MAX_VALUE;
|
||||
else
|
||||
return insertMaps.rows;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -710,8 +710,12 @@ final class UpdateQueryImpl<R extends Record> extends AbstractStoreQuery<R> impl
|
||||
return updateMap.size() > 0 || multiRow != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
final int estimatedRowCount() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user