[#6390] SQL Server multiple errors are not propagated if an update count precedes them
This commit is contained in:
parent
a2dbec2a2f
commit
c3273bb2dd
@ -430,7 +430,7 @@ abstract class AbstractQuery extends AbstractQueryPart implements Query {
|
||||
return result;
|
||||
}
|
||||
|
||||
// [#3011] [#3054] Consume additional exceptions if there are any
|
||||
// [#3011] [#3054] [#6390] Consume additional exceptions if there are any
|
||||
catch (SQLException e) {
|
||||
consumeExceptions(ctx.configuration(), stmt, e);
|
||||
throw e;
|
||||
|
||||
@ -506,7 +506,7 @@ public abstract class AbstractRoutine<T> extends AbstractQueryPart implements Ro
|
||||
listener.executeEnd(ctx);
|
||||
}
|
||||
|
||||
// [#3011] [#3054] Consume additional exceptions if there are any
|
||||
// [#3011] [#3054] [#6390] Consume additional exceptions if there are any
|
||||
catch (SQLException e) {
|
||||
consumeExceptions(ctx.configuration(), ctx.statement(), e);
|
||||
throw e;
|
||||
|
||||
@ -3038,8 +3038,8 @@ final class Tools {
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* [#3011] [#3054] Consume additional exceptions if there are any and append
|
||||
* them to the <code>previous</code> exception's
|
||||
* [#3011] [#3054] [#6390] Consume additional exceptions if there are any
|
||||
* and append them to the <code>previous</code> exception's
|
||||
* {@link SQLException#getNextException()} list.
|
||||
*/
|
||||
static final void consumeExceptions(Configuration configuration, PreparedStatement stmt, SQLException previous) {
|
||||
@ -3193,31 +3193,39 @@ final class Tools {
|
||||
int rows = (ctx.resultSet() == null) ? ctx.rows() : 0;
|
||||
|
||||
for (i = 0; i < maxConsumedResults; i++) {
|
||||
if (ctx.resultSet() != null) {
|
||||
anyResults = true;
|
||||
try {
|
||||
if (ctx.resultSet() != null) {
|
||||
anyResults = true;
|
||||
|
||||
Field<?>[] fields = new MetaDataFieldProvider(ctx.configuration(), ctx.resultSet().getMetaData()).getFields();
|
||||
Cursor<Record> c = new CursorImpl<Record>(ctx, listener, fields, intern != null ? intern.internIndexes(fields) : null, true, false);
|
||||
results.resultsOrRows().add(new ResultsImpl.ResultOrRowsImpl(c.fetch()));
|
||||
}
|
||||
else {
|
||||
if (rows != -1)
|
||||
results.resultsOrRows().add(new ResultsImpl.ResultOrRowsImpl(rows));
|
||||
else
|
||||
break;
|
||||
Field<?>[] fields = new MetaDataFieldProvider(ctx.configuration(), ctx.resultSet().getMetaData()).getFields();
|
||||
Cursor<Record> c = new CursorImpl<Record>(ctx, listener, fields, intern != null ? intern.internIndexes(fields) : null, true, false);
|
||||
results.resultsOrRows().add(new ResultsImpl.ResultOrRowsImpl(c.fetch()));
|
||||
}
|
||||
else {
|
||||
if (rows != -1)
|
||||
results.resultsOrRows().add(new ResultsImpl.ResultOrRowsImpl(rows));
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (ctx.statement().getMoreResults()) {
|
||||
ctx.resultSet(ctx.statement().getResultSet());
|
||||
}
|
||||
else {
|
||||
rows = ctx.statement().getUpdateCount();
|
||||
ctx.rows(rows);
|
||||
|
||||
if (rows != -1)
|
||||
ctx.resultSet(null);
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx.statement().getMoreResults()) {
|
||||
ctx.resultSet(ctx.statement().getResultSet());
|
||||
}
|
||||
else {
|
||||
rows = ctx.statement().getUpdateCount();
|
||||
ctx.rows(rows);
|
||||
|
||||
if (rows != -1)
|
||||
ctx.resultSet(null);
|
||||
else
|
||||
break;
|
||||
// [#3011] [#3054] [#6390] Consume additional exceptions if there are any
|
||||
catch (SQLException e) {
|
||||
consumeExceptions(ctx.configuration(), ctx.statement(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user