mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-29 05:54:21 +01:00
Fix the logic on determining whether connection is closed
This commit is contained in:
@@ -31,7 +31,6 @@ public abstract class LimboConnection implements Connection {
|
||||
public LimboConnection(String url, String filePath, Properties properties) throws SQLException {
|
||||
this.database = open(url, filePath, properties);
|
||||
this.connectionPtr = this.database.connect();
|
||||
this.closed = true;
|
||||
}
|
||||
|
||||
private static AbstractDB open(String url, String filePath, Properties properties)
|
||||
|
||||
@@ -88,8 +88,7 @@ public class JDBC4Connection extends LimboConnection {
|
||||
|
||||
@Override
|
||||
public boolean isClosed() throws SQLException {
|
||||
// TODO
|
||||
return false;
|
||||
return super.isClosed();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -68,13 +68,16 @@ class JDBC4ConnectionTest {
|
||||
|
||||
@Test
|
||||
void calling_close_multiple_times_throws_no_exception() throws Exception {
|
||||
assertFalse(connection.isClosed());
|
||||
connection.close();
|
||||
assertTrue(connection.isClosed());
|
||||
connection.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void calling_methods_on_closed_connection_should_throw_exception() throws Exception {
|
||||
connection.close();
|
||||
assertTrue(connection.isClosed());
|
||||
assertThrows(
|
||||
SQLException.class,
|
||||
() ->
|
||||
|
||||
Reference in New Issue
Block a user