Class JdbcRunner
java.lang.Object
org.pgcodekeeper.core.database.base.jdbc.JdbcRunner
JDBC statement execution runner with progress monitoring and cancellation support.
Provides methods for executing SQL statements, prepared statements, and batch operations
with progress tracking and interrupt handling.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new JDBC runner with a null progress monitor.JdbcRunner(IMonitor monitor) Creates a new JDBC runner with the specified progress monitor. -
Method Summary
Modifier and TypeMethodDescriptionvoidrun(PreparedStatement st) Executes a prepared statement with no return value.voidExecutes a statement using the given script with no return value.voidrun(IJdbcConnector connector, String script) Executes a script using a new connection from the connector.voidrunBatches(IJdbcConnector connector, List<ObjectLocation> batches, IProgressReporter reporter) Executes statement batches with no return value.Executes a prepared statement and returns the result set.Executes a statement using the given script and returns the result set.
-
Constructor Details
-
JdbcRunner
public JdbcRunner()Creates a new JDBC runner with a null progress monitor. -
JdbcRunner
Creates a new JDBC runner with the specified progress monitor.- Parameters:
monitor- the progress monitor for tracking execution and handling cancellation
-
-
Method Details
-
run
Executes a prepared statement with no return value.- Parameters:
st- the prepared statement to execute- Throws:
SQLException- if a database access error occursInterruptedException- if execution is interrupted
-
run
Executes a statement using the given script with no return value.- Parameters:
st- the statement to executescript- the SQL script to execute- Throws:
SQLException- if a database access error occursInterruptedException- if execution is interrupted
-
run
public void run(IJdbcConnector connector, String script) throws SQLException, IOException, InterruptedException Executes a script using a new connection from the connector.- Parameters:
connector- the JDBC connector for database connectionscript- the SQL script to execute- Throws:
SQLException- if a database access error occursIOException- if connection creation failsInterruptedException- if execution is interrupted
-
runBatches
public void runBatches(IJdbcConnector connector, List<ObjectLocation> batches, IProgressReporter reporter) throws SQLException, IOException, InterruptedException Executes statement batches with no return value.- Parameters:
connector- database connection informationbatches- list of query batches to executereporter- progress and result reporter- Throws:
SQLException- if a database access error occursIOException- if connection creation failsInterruptedException- if execution is interrupted
-
runScript
Executes a prepared statement and returns the result set.- Parameters:
st- the prepared statement to execute- Returns:
- the result set from the query
- Throws:
SQLException- if a database access error occursInterruptedException- if execution is interrupted
-
runScript
Executes a statement using the given script and returns the result set.- Parameters:
st- the statement to executescript- the SQL script to execute- Returns:
- the result set from the query
- Throws:
SQLException- if a database access error occursInterruptedException- if execution is interrupted
-