Class Database
java.lang.Object
com.booksaw.betterTeams.database.api.Database
- Direct Known Subclasses:
BetterTeamsDatabase
API Class to managing databases
- Author:
- booksaw
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidaddColumn(TableName table, String newColumnName, String columnDefinition, String referenceColumn, boolean after) voidUsed to close the connection to the databasevoidcreateTableIfNotExists(TableName tableName, String tableInfo) Used to create a table if the table does not currently existexecuteQuery(String query, String... placeholders) Used to execute an sql queryvoidexecuteStatement(String statement, String... placeholders) Used to execute an SQL statementbooleanChecks if a column exists in the specified table.voidUsed to setup a connection from the provided datavoidsetupConnectionFromConfiguration(org.bukkit.configuration.ConfigurationSection section) Used to setup a connection from the provided data
-
Constructor Details
-
Database
public Database()
-
-
Method Details
-
setupConnectionFromConfiguration
public void setupConnectionFromConfiguration(org.bukkit.configuration.ConfigurationSection section) Used to setup a connection from the provided data- Parameters:
section- The configuration section which contains the database information
-
setupConnection
public void setupConnection()Used to setup a connection from the provided data -
closeConnection
public void closeConnection()Used to close the connection to the database -
hasColumn
Checks if a column exists in the specified table.- Parameters:
table- The table to check.column- The column to check for.- Returns:
- True if the column exists, false otherwise.
-
addColumn
-
addColumn
-
executeStatement
Used to execute an SQL statement- Parameters:
statement- The SQL statement to executeplaceholders- The placeholders for the statement
-
executeQuery
Used to execute an sql query- Parameters:
query- The query to executeplaceholders- The placeholders within that query- Returns:
- The results of the query
-
createTableIfNotExists
Used to create a table if the table does not currently exist- Parameters:
tableName- The name of the tabletableInfo- The column information about the table
-