Package ortus.boxlang.runtime.jdbc
Class ExecutedQuery
java.lang.Object
ortus.boxlang.runtime.jdbc.ExecutedQuery
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 Summary
ConstructorsConstructorDescriptionExecutedQuery
(Query results, Object generatedKey, IStruct queryMeta) Constructor -
Method Summary
Modifier and TypeMethodDescriptionstatic ExecutedQuery
fromCachedQuery
(ExecutedQuery cachedQuery, IStruct cacheMeta) Build a new ExecutedQuery instance from a previously cached ExecutedQuery instance plus some cache metadata.static ExecutedQuery
fromPendingQuery
(PendingQuery pendingQuery, Statement statement, long executionTime, boolean hasResults) Creates an ExecutedQuery instance from a PendingQuery instance and a JDBC Statement.Returns the generated key of the query, if anyint
Returns the total count of records returned by the query.Returns the Query object of results of the query.getResultsAsStruct
(String key) Returns aStruct
instance grouping the results by the given key.
-
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
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
- ThePendingQuery
executed.statement
- TheStatement
instance executed.executionTime
- The execution time the query took.hasResults
- Boolean flag fromPreparedStatement.execute()
designating if the execution returned any results.
-
getResults
Returns the Query object of results of the query.- Returns:
- A Query object of results.
-
getResultsAsArray
- Returns:
- An Array of Structs representing the Query
-
getResultsAsStruct
Returns aStruct
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
Returns the generated key of the query, if any- Returns:
- The generated key of the query.
-