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 TypeMethodDescriptionvoid
deleteRecord
(TableName table, String condition) Used to delete a record from the specified tableUsed to a specific column value from theboolean
Used to check if an SQL query has a resultvoid
insertRecord
(TableName table, String columns, String values) Used to add a record into a tablevoid
insertRecordIfNotExists
(TableName table, String columns, String values) selectInnerJoinGroupByOrder
(String select, TableName table, TableName joinTable, String columToJoin, String groupBy, String orderBy) selectInnerJoinOrder
(String select, TableName table, TableName joinTable, String columToJoin, String orderBy) selectOrder
(String select, TableName from, String orderBy) selectWhere
(String select, TableName from, String where) selectWhereOrder
(String select, TableName from, String where, String orderBy) void
void
updateRecord
(TableName table, String update) Used to modify all records in a databasevoid
updateRecordWhere
(TableName table, String 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
-
selectWhereOrder
public PreparedStatement selectWhereOrder(String select, TableName from, String where, String orderBy) - Parameters:
select
- the element to selectfrom
- the table which the data is fromwhere
- the condition required for the data to be includedorderBy
- what to order the data by- 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
-
selectInnerJoinOrder
public PreparedStatement selectInnerJoinOrder(String select, TableName table, TableName joinTable, String columToJoin, String orderBy) - Parameters:
select
- the element to selecttable
- the table which the data is fromjoinTable
- the table to joincolumToJoin
- the details of the joinorderBy
- the order by conditions- Returns:
- The resultSet of the select
-
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
-