Package org.apache.ignite.sql
Interface IgniteSql
public interface IgniteSql
Ignite SQL query facade.
-
Method Summary
Modifier and TypeMethodDescriptioncreateStatement
(String query) Creates an SQL statement from a given query string.execute
(@Nullable Transaction transaction, @Nullable CancellationToken cancellationToken, String query, @Nullable Object... arguments) Executes a single SQL query.execute
(@Nullable Transaction transaction, @Nullable CancellationToken cancellationToken, Statement statement, @Nullable Object... arguments) Executes a single SQL statement.<T> ResultSet<T>
execute
(@Nullable Transaction transaction, @Nullable Mapper<T> mapper, @Nullable CancellationToken cancellationToken, String query, @Nullable Object... arguments) Executes single SQL statement and maps results to objects with the provided mapper.<T> ResultSet<T>
execute
(@Nullable Transaction transaction, @Nullable Mapper<T> mapper, @Nullable CancellationToken cancellationToken, Statement statement, @Nullable Object... arguments) Executes single SQL statement and maps results to objects with the provided mapper.default <T> ResultSet<T>
execute
(@Nullable Transaction transaction, @Nullable Mapper<T> mapper, String query, @Nullable Object... arguments) Executes single SQL statement and maps results to objects with the provided mapper.default <T> ResultSet<T>
execute
(@Nullable Transaction transaction, @Nullable Mapper<T> mapper, Statement statement, @Nullable Object... arguments) Executes single SQL statement and maps results to objects with the provided mapper.execute
(@Nullable Transaction transaction, String query, @Nullable Object... arguments) Executes a single SQL query.execute
(@Nullable Transaction transaction, Statement statement, @Nullable Object... arguments) Executes a single SQL statement.executeAsync
(@Nullable Transaction transaction, @Nullable CancellationToken cancellationToken, String query, @Nullable Object... arguments) Executes SQL query in an asynchronous way.executeAsync
(@Nullable Transaction transaction, @Nullable CancellationToken cancellationToken, Statement statement, @Nullable Object... arguments) Executes an SQL statement asynchronously.<T> CompletableFuture<AsyncResultSet<T>>
executeAsync
(@Nullable Transaction transaction, @Nullable Mapper<T> mapper, @Nullable CancellationToken cancellationToken, String query, @Nullable Object... arguments) Executes SQL statement in an asynchronous way and maps results to objects with the provided mapper.<T> CompletableFuture<AsyncResultSet<T>>
executeAsync
(@Nullable Transaction transaction, @Nullable Mapper<T> mapper, @Nullable CancellationToken cancellationToken, Statement statement, @Nullable Object... arguments) Executes SQL statement in an asynchronous way and maps results to objects with the provided mapper.default <T> CompletableFuture<AsyncResultSet<T>>
executeAsync
(@Nullable Transaction transaction, @Nullable Mapper<T> mapper, String query, @Nullable Object... arguments) Executes SQL statement in an asynchronous way and maps results to objects with the provided mapper.default <T> CompletableFuture<AsyncResultSet<T>>
executeAsync
(@Nullable Transaction transaction, @Nullable Mapper<T> mapper, Statement statement, @Nullable Object... arguments) Executes SQL statement in an asynchronous way and maps results to objects with the provided mapper.default CompletableFuture<AsyncResultSet<SqlRow>>
executeAsync
(@Nullable Transaction transaction, String query, @Nullable Object... arguments) Executes SQL query in an asynchronous way.default CompletableFuture<AsyncResultSet<SqlRow>>
executeAsync
(@Nullable Transaction transaction, Statement statement, @Nullable Object... arguments) Executes an SQL statement asynchronously.long[]
executeBatch
(@Nullable Transaction transaction, String dmlQuery, BatchedArguments batch) Executes a batched SQL query.long[]
executeBatch
(@Nullable Transaction transaction, Statement dmlStatement, BatchedArguments batch) Executes a batched SQL statement.CompletableFuture<long[]>
executeBatchAsync
(@Nullable Transaction transaction, String query, BatchedArguments batch) Executes a batched SQL query asynchronously.CompletableFuture<long[]>
executeBatchAsync
(@Nullable Transaction transaction, Statement statement, BatchedArguments batch) Executes a batched SQL statement asynchronously.void
executeScript
(@Nullable CancellationToken cancellationToken, String query, @Nullable Object... arguments) Executes a multi-statement SQL query.void
executeScript
(String query, @Nullable Object... arguments) Executes a multi-statement SQL query.executeScriptAsync
(@Nullable CancellationToken cancellationToken, String query, @Nullable Object... arguments) Executes a multi-statement SQL query.executeScriptAsync
(String query, @Nullable Object... arguments) Executes a multi-statement SQL query.Creates an SQL statement builder, which provides query-specific settings.
-
Method Details
-
createStatement
Creates an SQL statement from a given query string.- Parameters:
query
- SQL query string.- Returns:
- A new statement.
-
statementBuilder
Statement.StatementBuilder statementBuilder()Creates an SQL statement builder, which provides query-specific settings. These settings override the query execution context defaults when the statement is executed.- Returns:
- A new statement builder.
-
execute
default ResultSet<SqlRow> execute(@Nullable @Nullable Transaction transaction, String query, @Nullable @Nullable Object... arguments) Executes a single SQL query.- Parameters:
transaction
- Transaction to execute the query within ornull
.query
- SQL query template.arguments
- Arguments for the template (optional).- Returns:
- SQL query result set.
- Throws:
SqlException
- If failed.
-
execute
ResultSet<SqlRow> execute(@Nullable @Nullable Transaction transaction, @Nullable @Nullable CancellationToken cancellationToken, String query, @Nullable @Nullable Object... arguments) Executes a single SQL query.- Parameters:
transaction
- Transaction to execute the query within ornull
.cancellationToken
- Cancellation token ornull
.query
- SQL query template.arguments
- Arguments for the template (optional).- Returns:
- SQL query result set.
- Throws:
SqlException
- If failed.
-
execute
default ResultSet<SqlRow> execute(@Nullable @Nullable Transaction transaction, Statement statement, @Nullable @Nullable Object... arguments) Executes a single SQL statement.- Parameters:
transaction
- Transaction to execute the statement within ornull
.statement
- SQL statement to execute.arguments
- Arguments for the statement.- Returns:
- SQL query result set.
-
execute
ResultSet<SqlRow> execute(@Nullable @Nullable Transaction transaction, @Nullable @Nullable CancellationToken cancellationToken, Statement statement, @Nullable @Nullable Object... arguments) Executes a single SQL statement.- Parameters:
transaction
- Transaction to execute the statement within ornull
.cancellationToken
- Cancellation token ornull
.statement
- SQL statement to execute.arguments
- Arguments for the statement.- Returns:
- SQL query result set.
-
execute
default <T> ResultSet<T> execute(@Nullable @Nullable Transaction transaction, @Nullable @Nullable Mapper<T> mapper, String query, @Nullable @Nullable Object... arguments) Executes single SQL statement and maps results to objects with the provided mapper.- Type Parameters:
T
- A type of object contained in result set.- Parameters:
transaction
- Transaction to execute the statement within ornull
.mapper
- Mapper that defines the row type and the way to map columns to the type members. SeeMapper.of(java.lang.Class<O>)
.query
- SQL query template.arguments
- Arguments for the statement.- Returns:
- SQL query results set.
-
execute
<T> ResultSet<T> execute(@Nullable @Nullable Transaction transaction, @Nullable @Nullable Mapper<T> mapper, @Nullable @Nullable CancellationToken cancellationToken, String query, @Nullable @Nullable Object... arguments) Executes single SQL statement and maps results to objects with the provided mapper.- Type Parameters:
T
- A type of object contained in result set.- Parameters:
transaction
- Transaction to execute the statement within ornull
.cancellationToken
- Cancellation token ornull
.mapper
- Mapper that defines the row type and the way to map columns to the type members. SeeMapper.of(java.lang.Class<O>)
.query
- SQL query template.arguments
- Arguments for the statement.- Returns:
- SQL query results set.
-
execute
default <T> ResultSet<T> execute(@Nullable @Nullable Transaction transaction, @Nullable @Nullable Mapper<T> mapper, Statement statement, @Nullable @Nullable Object... arguments) Executes single SQL statement and maps results to objects with the provided mapper.- Type Parameters:
T
- A type of object contained in result set.- Parameters:
transaction
- Transaction to execute the statement within ornull
.mapper
- Mapper that defines the row type and the way to map columns to the type members. SeeMapper.of(java.lang.Class<O>)
.statement
- SQL statement to execute.arguments
- Arguments for the statement.- Returns:
- SQL query results set.
-
execute
<T> ResultSet<T> execute(@Nullable @Nullable Transaction transaction, @Nullable @Nullable Mapper<T> mapper, @Nullable @Nullable CancellationToken cancellationToken, Statement statement, @Nullable @Nullable Object... arguments) Executes single SQL statement and maps results to objects with the provided mapper.- Type Parameters:
T
- A type of object contained in result set.- Parameters:
transaction
- Transaction to execute the statement within ornull
.cancellationToken
- Cancellation token ornull
.mapper
- Mapper that defines the row type and the way to map columns to the type members. SeeMapper.of(java.lang.Class<O>)
.statement
- SQL statement to execute.arguments
- Arguments for the statement.- Returns:
- SQL query results set.
-
executeAsync
default CompletableFuture<AsyncResultSet<SqlRow>> executeAsync(@Nullable @Nullable Transaction transaction, String query, @Nullable @Nullable Object... arguments) Executes SQL query in an asynchronous way.- Parameters:
transaction
- Transaction to execute the query within ornull
.query
- SQL query template.arguments
- Arguments for the template (optional).- Returns:
- Operation future.
- Throws:
SqlException
- If failed.
-
executeAsync
CompletableFuture<AsyncResultSet<SqlRow>> executeAsync(@Nullable @Nullable Transaction transaction, @Nullable @Nullable CancellationToken cancellationToken, String query, @Nullable @Nullable Object... arguments) Executes SQL query in an asynchronous way.- Parameters:
transaction
- Transaction to execute the query within ornull
.cancellationToken
- Cancellation token ornull
.query
- SQL query template.arguments
- Arguments for the template (optional).- Returns:
- Operation future.
- Throws:
SqlException
- If failed.
-
executeAsync
default CompletableFuture<AsyncResultSet<SqlRow>> executeAsync(@Nullable @Nullable Transaction transaction, Statement statement, @Nullable @Nullable Object... arguments) Executes an SQL statement asynchronously.- Parameters:
transaction
- Transaction to execute the statement within ornull
.statement
- SQL statement to execute.arguments
- Arguments for the statement.- Returns:
- Operation future.
- Throws:
SqlException
- If failed.
-
executeAsync
default <T> CompletableFuture<AsyncResultSet<T>> executeAsync(@Nullable @Nullable Transaction transaction, @Nullable @Nullable Mapper<T> mapper, String query, @Nullable @Nullable Object... arguments) Executes SQL statement in an asynchronous way and maps results to objects with the provided mapper.- Type Parameters:
T
- A type of object contained in result set.- Parameters:
transaction
- Transaction to execute the statement within ornull
.mapper
- Mapper that defines the row type and the way to map columns to the type members. SeeMapper.of(java.lang.Class<O>)
.query
- SQL query template.arguments
- Arguments for the statement.- Returns:
- Operation future.
-
executeAsync
default <T> CompletableFuture<AsyncResultSet<T>> executeAsync(@Nullable @Nullable Transaction transaction, @Nullable @Nullable Mapper<T> mapper, Statement statement, @Nullable @Nullable Object... arguments) Executes SQL statement in an asynchronous way and maps results to objects with the provided mapper.- Type Parameters:
T
- A type of object contained in result set.- Parameters:
transaction
- Transaction to execute the statement within ornull
.mapper
- Mapper that defines the row type and the way to map columns to the type members. SeeMapper.of(java.lang.Class<O>)
.statement
- SQL statement to execute.arguments
- Arguments for the statement.- Returns:
- Operation future.
-
executeAsync
CompletableFuture<AsyncResultSet<SqlRow>> executeAsync(@Nullable @Nullable Transaction transaction, @Nullable @Nullable CancellationToken cancellationToken, Statement statement, @Nullable @Nullable Object... arguments) Executes an SQL statement asynchronously.- Parameters:
transaction
- Transaction to execute the statement within ornull
.cancellationToken
- Cancellation token ornull
.statement
- SQL statement to execute.arguments
- Arguments for the statement.- Returns:
- Operation future.
- Throws:
SqlException
- If failed.
-
executeAsync
<T> CompletableFuture<AsyncResultSet<T>> executeAsync(@Nullable @Nullable Transaction transaction, @Nullable @Nullable Mapper<T> mapper, @Nullable @Nullable CancellationToken cancellationToken, String query, @Nullable @Nullable Object... arguments) Executes SQL statement in an asynchronous way and maps results to objects with the provided mapper.- Type Parameters:
T
- A type of object contained in result set.- Parameters:
transaction
- Transaction to execute the statement within ornull
.cancellationToken
- Cancellation token ornull
.mapper
- Mapper that defines the row type and the way to map columns to the type members. SeeMapper.of(java.lang.Class<O>)
.query
- SQL query template.arguments
- Arguments for the statement.- Returns:
- Operation future.
-
executeAsync
<T> CompletableFuture<AsyncResultSet<T>> executeAsync(@Nullable @Nullable Transaction transaction, @Nullable @Nullable Mapper<T> mapper, @Nullable @Nullable CancellationToken cancellationToken, Statement statement, @Nullable @Nullable Object... arguments) Executes SQL statement in an asynchronous way and maps results to objects with the provided mapper.- Type Parameters:
T
- A type of object contained in result set.- Parameters:
transaction
- Transaction to execute the statement within ornull
.cancellationToken
- Cancellation token ornull
.mapper
- Mapper that defines the row type and the way to map columns to the type members. SeeMapper.of(java.lang.Class<O>)
.statement
- SQL statement to execute.arguments
- Arguments for the statement.- Returns:
- Operation future.
-
executeBatch
long[] executeBatch(@Nullable @Nullable Transaction transaction, String dmlQuery, BatchedArguments batch) Executes a batched SQL query. Only DML queries are supported.- Parameters:
transaction
- Transaction to execute the query within ornull
.dmlQuery
- DML query template.batch
- Batch of query arguments.- Returns:
- Number of rows affected by each query in the batch.
- Throws:
SqlBatchException
- If the batch fails.
-
executeBatch
long[] executeBatch(@Nullable @Nullable Transaction transaction, Statement dmlStatement, BatchedArguments batch) Executes a batched SQL statement. Only DML queries are supported.- Parameters:
transaction
- Transaction to execute the statement within ornull
.dmlStatement
- DML statement to execute.batch
- Batch of query arguments.- Returns:
- Number of rows affected by each query in the batch.
- Throws:
SqlBatchException
- If the batch fails.
-
executeBatchAsync
CompletableFuture<long[]> executeBatchAsync(@Nullable @Nullable Transaction transaction, String query, BatchedArguments batch) Executes a batched SQL query asynchronously.- Parameters:
transaction
- Transaction to execute the query within ornull
.query
- SQL query template.batch
- List of batch rows, where each row is a list of statement arguments.- Returns:
- Operation Future completed with the number of rows affected by each query in the batch
(if the batch succeeds), future completed with the
SqlBatchException
(if the batch fails).
-
executeBatchAsync
CompletableFuture<long[]> executeBatchAsync(@Nullable @Nullable Transaction transaction, Statement statement, BatchedArguments batch) Executes a batched SQL statement asynchronously.- Parameters:
transaction
- Transaction to execute the statement within ornull
.statement
- SQL statement to execute.batch
- List of batch rows, where each row is a list of statement arguments.- Returns:
- Operation Future completed with the number of rows affected by each query in the batch
(if the batch succeeds), future completed with the
SqlBatchException
(if the batch fails).
-
executeScript
Executes a multi-statement SQL query.- Parameters:
query
- SQL query template.arguments
- Arguments for the template (optional).- Throws:
SqlException
- If failed.
-
executeScript
void executeScript(@Nullable @Nullable CancellationToken cancellationToken, String query, @Nullable @Nullable Object... arguments) Executes a multi-statement SQL query.- Parameters:
cancellationToken
- Cancellation token ornull
.query
- SQL query template.arguments
- Arguments for the template (optional).- Throws:
SqlException
- If failed.
-
executeScriptAsync
Executes a multi-statement SQL query.- Parameters:
query
- SQL query template.arguments
- Arguments for the template (optional).- Returns:
- Operation future.
- Throws:
SqlException
- If failed.
-
executeScriptAsync
CompletableFuture<Void> executeScriptAsync(@Nullable @Nullable CancellationToken cancellationToken, String query, @Nullable @Nullable Object... arguments) Executes a multi-statement SQL query.- Parameters:
cancellationToken
- Cancellation token ornull
.query
- SQL query template.arguments
- Arguments for the template (optional).- Returns:
- Operation future.
- Throws:
SqlException
- If failed.
-