Package com.booksaw.betterTeams.database
Class BetterTeamsDatabase
java.lang.Object
com.booksaw.betterTeams.database.api.Database
com.booksaw.betterTeams.database.BetterTeamsDatabase
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteRecord(TableName table, String condition) Used to delete a record from the specified tableUsed to a specific column value from thebooleanUsed to check if an SQL query has a resultvoidinsertRecord(TableName table, String columns, String values) Used to add a record into a tablevoidinsertRecordIfNotExists(TableName table, String columns, String values) selectInnerJoinGroupByOrder(String select, TableName table, TableName joinTable, String columToJoin, String groupBy, String orderBy) selectOrder(String select, TableName from, String orderBy) selectWhere(String select, TableName from, String where) voidvoidupdateRecord(TableName table, String update) Used to modify all records in a databasevoidupdateRecordWhere(TableName table, String field, Object update, String condition) Used to modify a record in the databaseMethods inherited from class com.booksaw.betterTeams.database.api.Database
addColumn, addColumn, closeConnection, createTableIfNotExists, executeQuery, executeStatement, hasColumn, setupConnection, setupConnectionFromConfiguration
-
Constructor Details
-
BetterTeamsDatabase
public BetterTeamsDatabase()
-
-
Method Details
-
setupTables
public void setupTables() -
select
-
selectWhere
- Parameters:
select- the element to selectfrom- the table which the data is fromwhere- the condition required for the data to be included- Returns:
- the resultant resultSet
-
selectOrder
- Parameters:
select- the element to selectfrom- the table which the data is fromorderBy- what to order the data by- Returns:
- The resultant resultset
-
selectInnerJoinGroupByOrder
-
hasResult
Used to check if an SQL query has a result- Parameters:
from- the table which the data is fromwhere- the condition required for the data to be included- Returns:
- if the query has a result
-
getResult
Used to a specific column value from the- Parameters:
column- The column namefrom- the tablewhere- the condition- Returns:
- the first returned result, the specified column. Will return "" if an error occurs
-
deleteRecord
Used to delete a record from the specified table- Parameters:
table- The table to updatecondition- The condition for the update
-
updateRecordWhere
Used to modify a record in the database- Parameters:
table- the table the record is inupdate- the values to update (ie "col = exp1, col2 = exp2")condition- The condition for which records should be updated
-
updateRecord
Used to modify all records in a database- Parameters:
table- the table to modifyupdate- the value to update (ie "col = exp1, col2 = exp2")
-
insertRecord
Used to add a record into a table- Parameters:
table- The table to insert the record intocolumns- The columns that data is being provided for (ie "col1, col2, col3)values- the values to insert (ie "val1, val2, val3")
-
insertRecordIfNotExists
-