Skip to content

Commit

Permalink
add setSQL and getSQL
Browse files Browse the repository at this point in the history
  • Loading branch information
Snabeldier committed Jan 2, 2025
1 parent cd7a4d1 commit b331ce1
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/main/java/minevalley/core/api/database/StatementBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.sql.*;
import java.util.concurrent.CompletableFuture;

/**
/**
* This interface covers some but not nearly all features of the {@link PreparedStatement} interface as provided by the JDBC API.
* It's designed to provide some improvements such as an asynchronous execution and a builder pattern for setting parameters to reduce boilerplate code.
* Such as the {@link PreparedStatement} interface, the results of the query can be retrieved using the {@link ResultSet} interface.
Expand All @@ -31,6 +31,27 @@
@SuppressWarnings("unused")
public interface StatementBuilder extends AutoCloseable {

/**
* Gets the SQL code that will be executed when calling one of the {@code execute} methods.
*
* @throws IllegalStateException if this method is called on a closed {@code StatementBuilder}
*/
@Nonnull
@Contract(pure = true)
String getSQL() throws IllegalStateException;

/**
* Sets the SQL code that will be executed when calling one of the {@code execute} methods.
*
* @param sql the SQL code to set
* @return this {@code StatementBuilder} object
* @throws IllegalArgumentException if {@code sql} is {@code null}
* @throws IllegalStateException if this method is called on a closed {@code StatementBuilder}
*/
@Nonnull
@Contract("_ -> this")
StatementBuilder setSQL(@Nonnull String sql) throws IllegalArgumentException, IllegalStateException;

/**
* Sets the parameter at the given index to SQL {@code NULL}.
* <p>
Expand Down

0 comments on commit b331ce1

Please sign in to comment.