Package io.github.pigaut.sql
Interface Database
- All Known Implementing Classes:
FileDatabase
public interface Database
-
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclearTable(String table)voidcreateStatement(String sql)Creates a statement for this database with the given sqlvoidcreateTableIfNotExists(String name, String... columns)voidvoidExecutes a SQL statement against the database.longexecuteLargeUpdate(String sql)Executes a large update SQL statement that may modify the database.voidexecuteQuery(String sql, QueryReader reader)Executes an SQL query and processes the results using a QueryReader.voidexecuteRowQuery(String sql, QueryReader reader)Executes an SQL query and processes the results using a QueryReader.intexecuteUpdate(String sql)Executes an SQL statement that may modify the database (such as INSERT, UPDATE, DELETE).Retrieves the DataSource associated with this database.booleanvoidvoidrenameColumn(String table, String column, String newName)voidrenameTable(String table, String newName)
-
Method Details
-
isConnected
boolean isConnected() -
openConnection
void openConnection() -
closeConnection
void closeConnection() -
getDataSource
DataSource getDataSource()Retrieves the DataSource associated with this database.- Returns:
- The DataSource instance used for database connections.
-
createTableIfNotExists
-
dropTable
-
renameTable
-
addColumn
-
renameColumn
-
clearTable
-
insert
-
merge
-
selectAll
-
createStatement
Creates a statement for this database with the given sql- Parameters:
sql- the sql statement- Returns:
- a new DatabaseStatement
-
execute
Executes a SQL statement against the database.- Parameters:
sql- The SQL statement to execute.
-
executeUpdate
Executes an SQL statement that may modify the database (such as INSERT, UPDATE, DELETE).- Parameters:
sql- The SQL statement to execute.- Returns:
- The number of rows affected by the statement.
-
executeLargeUpdate
Executes a large update SQL statement that may modify the database.- Parameters:
sql- The SQL statement to execute.- Returns:
- The number of rows affected by the statement.
-
executeQuery
Executes an SQL query and processes the results using a QueryReader.- Parameters:
sql- The SQL query to execute.reader- The QueryReader implementation to process the query results.
-
executeRowQuery
Executes an SQL query and processes the results using a QueryReader.- Parameters:
sql- The SQL query to execute.reader- The QueryReader implementation to process the query results.
-