Skip to content

Commit 865fddf

Browse files
committed
static sql
1 parent f393a1d commit 865fddf

File tree

11 files changed

+595
-722
lines changed

11 files changed

+595
-722
lines changed

persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/DatasourceOperations.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public class DatasourceOperations {
5454
private static final String SERIALIZATION_FAILURE_SQL_CODE = "40001";
5555

5656
private final DataSource datasource;
57-
private final RelationalJdbcConfiguration relationalJdbcConfiguration;
5857
private final DatabaseType databaseType;
58+
private final RelationalJdbcConfiguration relationalJdbcConfiguration;
5959

6060
private final Random random = new Random();
6161

@@ -126,8 +126,7 @@ public void executeScript(String scriptFilePath) throws SQLException {
126126
* @throws SQLException : Exception during the query execution.
127127
*/
128128
public <T> List<T> executeSelect(
129-
@Nonnull QueryGenerator.PreparedQuery query, @Nonnull Converter<T> converterInstance)
130-
throws SQLException {
129+
@Nonnull PreparedQuery query, @Nonnull Converter<T> converterInstance) throws SQLException {
131130
ArrayList<T> results = new ArrayList<>();
132131
executeSelectOverStream(query, converterInstance, stream -> stream.forEach(results::add));
133132
return results;
@@ -144,7 +143,7 @@ public <T> List<T> executeSelect(
144143
* @throws SQLException : Exception during the query execution.
145144
*/
146145
public <T> void executeSelectOverStream(
147-
@Nonnull QueryGenerator.PreparedQuery query,
146+
@Nonnull PreparedQuery query,
148147
@Nonnull Converter<T> converterInstance,
149148
@Nonnull Consumer<Stream<T>> consumer)
150149
throws SQLException {
@@ -172,7 +171,7 @@ public <T> void executeSelectOverStream(
172171
* @return : Number of rows modified / inserted.
173172
* @throws SQLException : Exception during Query Execution.
174173
*/
175-
public int executeUpdate(QueryGenerator.PreparedQuery preparedQuery) throws SQLException {
174+
public int executeUpdate(PreparedQuery preparedQuery) throws SQLException {
176175
return withRetries(
177176
() -> {
178177
try (Connection connection = borrowConnection();
@@ -223,9 +222,9 @@ public void runWithinTransaction(TransactionCallback callback) throws SQLExcepti
223222
});
224223
}
225224

226-
public Integer execute(Connection connection, QueryGenerator.PreparedQuery preparedQuery)
227-
throws SQLException {
225+
public Integer execute(Connection connection, PreparedQuery preparedQuery) throws SQLException {
228226
try (PreparedStatement statement = connection.prepareStatement(preparedQuery.sql())) {
227+
System.out.println(preparedQuery.sql());
229228
List<Object> params = preparedQuery.parameters();
230229
for (int i = 0; i < params.size(); i++) {
231230
statement.setObject(i + 1, params.get(i));

0 commit comments

Comments
 (0)