Package net.bugreaper.modules.db
Class MariaDb
MariaDb helper that provides a common API for operating with MariaDb.
It is recommended to use a single instance:
MariaDb db = MariaDb.getInstance();
Provides:
- Assertions with await support
- Data manipulation operations such as create, update, and clean
For more information, see JdbcExecutor.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertCountInTableBuilder(String tableName, String conditions, Object[][] conditionsArray, String expectedCount, int awaitMs) static MariaDbprotected String[]getTableColumns(String tableName) Returns the list of columns in the table.protected voidrecordExistsBuilder(String tableName, String conditions, Object[][] conditionsArray, int awaitMs) protected voidseeInDbByCondMethod(String tableName, String conditions) protected voidshowDataFromTableMethod(String tableName) Methods inherited from class net.bugreaper.modules.db.jdbc.JdbcExecutor
deleteFromTable, deleteFromTable, deleteFromTable, getConfigSummary, insertIntoTable, insertIntoTable, insertIntoTable, renameTable, rollbackTable, runScript, runScriptFromFile, seeRecordExistsInTable, seeRecordExistsInTable, seeRecordExistsInTableCustom, seeRowsCountInTableExactly, seeRowsCountInTableExactly, seeRowsCountInTableExactly, seeRowsCountInTableExactlyCustom, seeTableIsEmpty, seeTableIsNotEmpty, self, setAwaitMs, setTemplatesDirectory, showDataByCondition, showDataFromTable, truncateTable, truncateTables, updateTable, updateTable, updateTable, withAwaitMs
-
Field Details
-
jdbc
-
getColumnsQuery
-
url
-
username
-
password
-
SELECT_ALL
- See Also:
-
COUNT
- See Also:
-
-
Constructor Details
-
MariaDb
Creates a new MariaDb database helper instance with the specified connection parameters.- Parameters:
dbUrl- the JDBC connection URL for the MariaDb databaseusername- the username used to authenticate with the databasepasswd- the password used to authenticate with the database- Throws:
IllegalArgumentException- if any of the required parameters are null or empty
-
MariaDb
public MariaDb()Constructs a MariaDB client using YAML configuration.Loads configuration values from a YAML file.
Example:MariaDb db = new MariaDb();mariadb: url: 'jdbc:mariadb://localhost:3308' username: user password: pass await: 1000 (optional)
- See Also:
-
-
Method Details
-
getInstance
Returns the instance ofMariaDbwith config builderMariaDb().This implementation is thread-safe using method-level synchronization.
- Returns:
- the shared instance of
MariaDb - Throws:
IllegalArgumentException- if the configuration contains invalid values- See Also:
-
assertCountInTableBuilder
-
recordExistsBuilder
-
showDataFromTableMethod
-
seeInDbByCondMethod
-
getTableColumns
Returns the list of columns in the table.- Parameters:
tableName- table name in the formatschema_name.table_name- Returns:
- array containing column names
-