Package ortus.boxlang.runtime.jdbc
Class PendingQuery
java.lang.Object
ortus.boxlang.runtime.jdbc.PendingQuery
This class represents a query and any parameters/bindings before being executed.
After calling
, it returns an
invalid reference
#execute()
ExecutedQuery
with a reference to this object.-
Constructor Summary
ConstructorsConstructorDescriptionPendingQuery
(String sql, Object bindings, QueryOptions queryOptions) Creates a new PendingQuery instance from a SQL string, a list of parameters, and the original SQL string.PendingQuery
(String sql, List<QueryParameter> parameters) Creates a new PendingQuery instance from a SQL string and a list of parameters. -
Method Summary
Modifier and TypeMethodDescriptionexecute
(Connection connection) Executes the PendingQuery on a givenConnection
and returns the results in anExecutedQuery
instance.execute
(ConnectionManager connectionManager) Executes the PendingQuery using the provided ConnectionManager and returns the results in anExecutedQuery
instance.Returns the original sql for this PendingQueryReturns a list of parameter `Object` values from the `List`.
-
Constructor Details
-
PendingQuery
Creates a new PendingQuery instance from a SQL string, a list of parameters, and the original SQL string.- Parameters:
sql
- The SQL string to executeparameters
- A list ofQueryParameter
to use as bindings.originalSql
- The original sql string. This will include named parameters if the `PendingQuery` was constructed using anIStruct
.
-
PendingQuery
Creates a new PendingQuery instance from a SQL string and a list of parameters. This constructor uses the provided SQL string as the original SQL.- Parameters:
sql
- The SQL string to executeparameters
- A list ofQueryParameter
to use as bindings.
-
-
Method Details
-
getOriginalSql
Returns the original sql for this PendingQuery- Returns:
- The original sql string
-
getParameterValues
Returns a list of parameter `Object` values from the `List`. - Returns:
- A list of parameter values as `Object`s.
-
execute
Executes the PendingQuery using the provided ConnectionManager and returns the results in anExecutedQuery
instance.- Parameters:
connectionManager
- The ConnectionManager instance to use for getting connections from the current context.- Returns:
- An ExecutedQuery instance with the results of this JDBC execution, as well as a link to this PendingQuery instance.
- Throws:
DatabaseException
- If aSQLException
occurs, wraps it in a DatabaseException and throws.- See Also:
-
execute
Executes the PendingQuery on a givenConnection
and returns the results in anExecutedQuery
instance.- Parameters:
connection
- The Connection instance to use for executing the query. It is the responsibility of the caller to close the connection after this method returns.- Returns:
- An ExecutedQuery instance with the results of this JDBC execution, as well as a link to this PendingQuery instance.
- Throws:
DatabaseException
- If aSQLException
occurs, wraps it in a DatabaseException and throws.- See Also:
-