Interface IgniteSql


public interface IgniteSql
Ignite SQL query facade.
  • Method Details

    • createStatement

      Statement createStatement(String query)
      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 or null.
      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 or null.
      cancellationToken - Cancellation token or null.
      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 or null.
      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 or null.
      cancellationToken - Cancellation token or null.
      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 or null.
      mapper - Mapper that defines the row type and the way to map columns to the type members. See Mapper.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 or null.
      cancellationToken - Cancellation token or null.
      mapper - Mapper that defines the row type and the way to map columns to the type members. See Mapper.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 or null.
      mapper - Mapper that defines the row type and the way to map columns to the type members. See Mapper.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 or null.
      cancellationToken - Cancellation token or null.
      mapper - Mapper that defines the row type and the way to map columns to the type members. See Mapper.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 or null.
      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 or null.
      cancellationToken - Cancellation token or null.
      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 or null.
      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 or null.
      mapper - Mapper that defines the row type and the way to map columns to the type members. See Mapper.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 or null.
      mapper - Mapper that defines the row type and the way to map columns to the type members. See Mapper.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 or null.
      cancellationToken - Cancellation token or null.
      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 or null.
      cancellationToken - Cancellation token or null.
      mapper - Mapper that defines the row type and the way to map columns to the type members. See Mapper.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 or null.
      cancellationToken - Cancellation token or null.
      mapper - Mapper that defines the row type and the way to map columns to the type members. See Mapper.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 or null.
      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 or null.
      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 or null.
      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 or null.
      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

      void executeScript(String query, @Nullable @Nullable Object... arguments)
      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 or null.
      query - SQL query template.
      arguments - Arguments for the template (optional).
      Throws:
      SqlException - If failed.
    • executeScriptAsync

      CompletableFuture<Void> executeScriptAsync(String query, @Nullable @Nullable Object... arguments)
      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 or null.
      query - SQL query template.
      arguments - Arguments for the template (optional).
      Returns:
      Operation future.
      Throws:
      SqlException - If failed.