Don't clear isCommitStateDirty flag in setReadOnly (#1842)

When autoCommit is false, if setReadOnly is called after some queries, then closing the connection leads to dirty (transaction opened) connection being reused.
pull/2238/head
Taeho Kim 3 months ago committed by GitHub
parent 9f9175195e
commit 004671d826
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -430,7 +430,6 @@ public abstract class ProxyConnection implements Connection
{ {
delegate.setReadOnly(readOnly); delegate.setReadOnly(readOnly);
isReadOnly = readOnly; isReadOnly = readOnly;
isCommitStateDirty = false;
dirtyBits |= DIRTY_BIT_READONLY; dirtyBits |= DIRTY_BIT_READONLY;
} }

@ -164,6 +164,9 @@ public class ConnectionStateTest
resultSet.updateRow(); resultSet.updateRow();
assertTrue(TestElf.getConnectionCommitDirtyState(connection)); assertTrue(TestElf.getConnectionCommitDirtyState(connection));
connection.setReadOnly(!connection.isReadOnly());
assertTrue(TestElf.getConnectionCommitDirtyState(connection));
} }
} }
} }

Loading…
Cancel
Save