Class QueryResult

java.lang.Object
io.trino.tempto.query.QueryResult
All Implemented Interfaces:
org.assertj.core.api.AssertProvider<QueryAssert>

public class QueryResult extends Object implements org.assertj.core.api.AssertProvider<QueryAssert>
Result of a query.

It stores all returned values, column names and their types as JDBCType.

  • Method Details

    • getRowsCount

      public int getRowsCount()
    • getColumnsCount

      public int getColumnsCount()
    • getColumnTypes

      public List<JDBCType> getColumnTypes()
    • getColumnType

      public JDBCType getColumnType(int columnIndex)
    • tryFindColumnIndex

      public Optional<Integer> tryFindColumnIndex(String columnName)
    • row

      public List<?> row(int rowIndex)
    • rows

      public List<List<?>> rows()
    • getOnlyValue

      public Object getOnlyValue()
    • column

      public <T> List<T> column(int sqlColumnIndex)
    • project

      public QueryResult project(int... sqlColumnIndexes)
    • getJdbcResultSet

      public Optional<ResultSet> getJdbcResultSet()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • assertThat

      public QueryAssert assertThat()
      Specified by:
      assertThat in interface org.assertj.core.api.AssertProvider<QueryAssert>
    • toSqlIndex

      public static int toSqlIndex(int index)
      In SQL/JDBC column indexing starts form 1. This method returns SQL index for given Java index.
      Parameters:
      index - 0 based column index
      Returns:
      index + 1
    • fromSqlIndex

      public static int fromSqlIndex(int index)
      In SQL/JDBC column indexing starts form 1. This method returns Java index for given SQL index.
      Parameters:
      index - 1 based column index
      Returns:
      index - 1;
    • builder

      public static QueryResult.QueryResultBuilder builder(ResultSetMetaData metaData) throws SQLException
      Throws:
      SQLException
    • forSingleIntegerValue

      public static QueryResult forSingleIntegerValue(int value)
    • forSingleValue

      public static <T> QueryResult forSingleValue(JDBCType type, T value)
    • empty

      public static QueryResult empty()
    • forResultSet

      public static QueryResult forResultSet(ResultSet rs) throws SQLException
      Throws:
      SQLException