Class ExecutedQuery

java.lang.Object
ortus.boxlang.runtime.jdbc.ExecutedQuery

public final class ExecutedQuery extends Object
This class represents a query that has been executed and contains the results of executing that query. It contains a reference to the PendingQuery that was executed to create this.
  • Constructor Details

    • ExecutedQuery

      public ExecutedQuery(@Nonnull Query results, @Nullable Object generatedKey, @Nullable IStruct queryMeta)
      Constructor
      Parameters:
      results - The results of the query, i.e. the actual Query object.
      generatedKey - The generated key of the query, if any.
      queryMeta - Struct of query metadata, such as original SQL, parameters, size, and cache info.
  • Method Details

    • fromCachedQuery

      public static ExecutedQuery fromCachedQuery(@Nonnull ExecutedQuery cachedQuery, IStruct cacheMeta)
      Build a new ExecutedQuery instance from a previously cached ExecutedQuery instance plus some cache metadata.
    • fromPendingQuery

      public static ExecutedQuery fromPendingQuery(@Nonnull PendingQuery pendingQuery, @Nonnull Statement statement, long executionTime, boolean hasResults)
      Creates an ExecutedQuery instance from a PendingQuery instance and a JDBC Statement.
      Parameters:
      pendingQuery - The PendingQuery executed.
      statement - The Statement instance executed.
      executionTime - The execution time the query took.
      hasResults - Boolean flag from PreparedStatement.execute() designating if the execution returned any results.
    • getResults

      @Nonnull public Query getResults()
      Returns the Query object of results of the query.
      Returns:
      A Query object of results.
    • getResultsAsArray

      @Nonnull public Array getResultsAsArray()
      Returns an Array of Struct instances representing the Query results.
      Returns:
      An Array of Structs representing the Query
    • getResultsAsStruct

      @Nonnull public IStruct getResultsAsStruct(@Nonnull String key)
      Returns a Struct instance grouping the results by the given key.
      Parameters:
      key - The column to group the results by.
      Returns:
      A struct of String to Struct instances representing the Query results.
    • getRecordCount

      public int getRecordCount()
      Returns the total count of records returned by the query.
      Returns:
      The total count of records.
    • getGeneratedKey

      @Nullable public Object getGeneratedKey()
      Returns the generated key of the query, if any
      Returns:
      The generated key of the query.