java.lang.Object
org.litebridge.orm.nativesql.NativeSqlContext
Provides a context for executing native SQL queries and updates in a transactional database environment.
This class facilitates the execution of raw SQL operations using the capabilities provided
by a TransactionalDatabaseProvider.
It supports parameterised SQL queries and updates with flexible parameter binding and ensures that all database interactions are performed in a transactional context.
-
Constructor Summary
ConstructorsConstructorDescriptionNativeSqlContext(TransactionalDatabaseProvider databaseProvider) Constructs a newNativeSqlContextinstance. -
Method Summary
Modifier and TypeMethodDescriptionExecutes a SQL update statement with the given SQL string and a variable-length list of positional bind parameters.Executes a SQL update statement with the given SQL string and a list of positional bind parameters.Executes a SQL update statement with the given SQL string and a map of named bind parameters.Executes a SQL query with the given SQL string and a variable-length list of positional bind parameters.Executes a SQL query with the given SQL string and a list of positional bind parameters.Executes a SQL query with the given SQL string and a map of named bind parameters.
-
Constructor Details
-
NativeSqlContext
Constructs a newNativeSqlContextinstance.- Parameters:
databaseProvider- the database provider to use for executing SQL operations
-
-
Method Details
-
query
Executes a SQL query with the given SQL string and a variable-length list of positional bind parameters.This method takes a variable number of parameters and delegates to the overloaded query method that accepts a list of bind parameters.
- Parameters:
sql- the SQL query string to be executed; must not benullbindParameters- the variable-length list of parameters to bind to the query- Returns:
- a list of
Rowobjects representing the result set of the query - Throws:
IllegalStateException- if an error occurs during query execution
-
query
Executes a SQL query with the given SQL string and a list of positional bind parameters.- Parameters:
sql- the SQL query string to be executed; must not benullbindParameters- the list of parameters to bind to the query- Returns:
- a list of
Rowobjects representing the result set of the query - Throws:
IllegalStateException- if an error occurs during query execution
-
query
Executes a SQL query with the given SQL string and a map of named bind parameters.- Parameters:
sql- the SQL query string to be executed; must not benullbindParameters- the map of named parameters to bind to the query- Returns:
- a list of
Rowobjects representing the result set of the query - Throws:
IllegalStateException- if an error occurs during query execution
-
execute
Executes a SQL update statement with the given SQL string and a variable-length list of positional bind parameters.This method delegates to the overloaded execute method that accepts a list of bind parameters.
- Parameters:
sql- the SQL update statement to execute; must not benullbindParameters- the variable-length list of positional parameters to bind to the statement- Returns:
- an
UpdateResultobject that encapsulates the outcome of the update operation - Throws:
IllegalStateException- if an error occurs while executing the update statement
-
execute
Executes a SQL update statement with the given SQL string and a list of positional bind parameters.- Parameters:
sql- the SQL update statement to execute; must not benullbindParameters- the variable-length list of positional parameters to bind to the statement- Returns:
- an
UpdateResultobject that encapsulates the outcome of the update operation - Throws:
IllegalStateException- if an error occurs while executing the update statement
-
execute
Executes a SQL update statement with the given SQL string and a map of named bind parameters.- Parameters:
sql- the SQL update statement to execute; must not benullbindParameters- the map of named parameters to bind to the statement- Returns:
- an
UpdateResultobject that encapsulates the outcome of the update operation - Throws:
IllegalStateException- if an error occurs while executing the update statement
-