Skip to content

Commit 337dd62

Browse files
committed
Remove Db2 handling
1 parent 6e9e026 commit 337dd62

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcPermissionTestUtils.java

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,25 @@ public JdbcPermissionTestUtils(Properties properties) {
2121

2222
@Override
2323
public void createNormalUser(String userName, String password) {
24-
if (!JdbcTestUtils.isDb2(rdbEngine)) {
25-
try (Connection connection = dataSource.getConnection()) {
26-
String createUserSql = getCreateUserSql(userName, password);
27-
try (Statement statement = connection.createStatement()) {
28-
statement.execute(createUserSql);
29-
}
30-
} catch (SQLException e) {
31-
throw new RuntimeException("Failed to create user: " + userName, e);
24+
try (Connection connection = dataSource.getConnection()) {
25+
String createUserSql = getCreateUserSql(userName, password);
26+
try (Statement statement = connection.createStatement()) {
27+
statement.execute(createUserSql);
3228
}
29+
} catch (SQLException e) {
30+
throw new RuntimeException("Failed to create user: " + userName, e);
3331
}
3432
}
3533

3634
@Override
3735
public void dropNormalUser(String userName) {
38-
if (!JdbcTestUtils.isDb2(rdbEngine)) {
39-
try (Connection connection = dataSource.getConnection()) {
40-
String dropUserSql = getDropUserSql(userName);
41-
try (Statement statement = connection.createStatement()) {
42-
statement.execute(dropUserSql);
43-
}
44-
} catch (SQLException e) {
45-
throw new RuntimeException("Failed to drop user: " + userName, e);
36+
try (Connection connection = dataSource.getConnection()) {
37+
String dropUserSql = getDropUserSql(userName);
38+
try (Statement statement = connection.createStatement()) {
39+
statement.execute(dropUserSql);
4640
}
41+
} catch (SQLException e) {
42+
throw new RuntimeException("Failed to drop user: " + userName, e);
4743
}
4844
}
4945

@@ -133,11 +129,6 @@ private String[] getGrantPermissionStatements(String userName) {
133129
String.format("ALTER ROLE [db_datareader] ADD MEMBER %s", userName),
134130
String.format("ALTER ROLE [db_datawriter] ADD MEMBER %s", userName)
135131
};
136-
} else if (JdbcTestUtils.isDb2(rdbEngine)) {
137-
return new String[] {
138-
String.format("GRANT DBADM ON DATABASE TO USER %s", userName),
139-
String.format("GRANT DATAACCESS ON DATABASE TO USER %s", userName)
140-
};
141132
} else {
142133
throw new UnsupportedOperationException(
143134
"Granting permissions is not supported for " + rdbEngine);

0 commit comments

Comments
 (0)