Skip to content

Commit

Permalink
Issue helidon-io#6991 - Blocking DB Client: Lazy statement preparatio…
Browse files Browse the repository at this point in the history
…n and execution

Signed-off-by: Tomáš Kraus <tomas.kraus@oracle.com>
  • Loading branch information
Tomas-Kraus committed Jun 28, 2023
1 parent d40d508 commit 7e2973b
Show file tree
Hide file tree
Showing 27 changed files with 751 additions and 1,044 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* The last two methods directly execute the statement and provide appropriate response for future processing.
* All the methods are non-blocking.
*/
public interface DbExecute extends AutoCloseable {
public interface DbExecute {

/*
* QUERY
Expand Down Expand Up @@ -361,9 +361,8 @@ default long dml(String statement, Object... parameters) {
* Unwrap database executor internals.
* Only database connection is supported. This connection instance is being used to execute
* all statements in current database executor context.
* <p>When {@code java.sql.Connection} is requested for JDBC provider, this connection life cycle
* is bound to this {@link DbExecute} instance life cycle. Explicit {@code close()} method call
* on returned connection instance is not required.
* <p>When {@code java.sql.Connection} is requested for JDBC provider, this connection must be closed
* by user code using {@code close()} method on returned {@code Connection} instance.
*
* @param <C> target class to be unwrapped
* @param cls target class to be unwrapped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

/**
* Database query statement.
* <p><b>Important:</b> Method {@link #execute()} returns {@link Stream} of {@link DbRow}. This {@link Stream} must
* always be closed because it holds database resources ({@code java.sql.Connection}, {@code java.sql.Statement}
* and {@code java.sql.ResultSet}).
*/
public interface DbStatementQuery extends DbStatement<DbStatementQuery, Stream<DbRow>> {
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2022 Oracle and/or its affiliates.
* Copyright (c) 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2022 Oracle and/or its affiliates.
* Copyright (c) 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* Hikari Connection Pool integration.
*/
public class HikariConnectionPool implements JdbcConnectionPool {
class HikariConnectionPool implements JdbcConnectionPool {
/** Hikari Connection Pool instance. */
private final HikariDataSource dataSource;

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class JdbcClient extends CommonClient implements DbClient {

@Override
public JdbcExecute execute() {
return JdbcExecute.create(context(), connectionPool.connection());
return JdbcExecute.create(context(), connectionPool);
}

@Override
Expand All @@ -54,4 +54,4 @@ public <C> C unwrap(Class<C> cls) {
}
}

}
}
Loading

0 comments on commit 7e2973b

Please sign in to comment.