Modifier and Type | Field and Description |
---|---|
protected org.bukkit.plugin.Plugin |
plugin
Plugin instance, use for plugin.getDataFolder()
|
Modifier | Constructor and Description |
---|---|
protected |
Database(org.bukkit.plugin.Plugin plugin)
Creates a new Database
|
Modifier and Type | Method and Description |
---|---|
abstract boolean |
checkConnection()
Checks if a connection is open with the database
|
abstract boolean |
closeConnection()
Closes the connection with the database
|
abstract java.sql.Connection |
getConnection()
Gets the connection with the database
|
abstract java.sql.Connection |
openConnection()
Opens a connection with the database
|
abstract java.sql.ResultSet |
querySQL(java.lang.String query)
Executes a SQL Query
If the connection is closed, it will be opened |
abstract int |
updateSQL(java.lang.String query)
Executes an Update SQL Query
See Statement.executeUpdate(String) If the connection is closed, it will be opened |
protected org.bukkit.plugin.Plugin plugin
protected Database(org.bukkit.plugin.Plugin plugin)
plugin
- Plugin instancepublic abstract java.sql.Connection openConnection() throws java.sql.SQLException, java.lang.ClassNotFoundException
java.sql.SQLException
- if the connection can not be openedjava.lang.ClassNotFoundException
- if the driver cannot be foundpublic abstract boolean checkConnection() throws java.sql.SQLException
java.sql.SQLException
- if the connection cannot be checkedpublic abstract java.sql.Connection getConnection()
public abstract boolean closeConnection() throws java.sql.SQLException
java.sql.SQLException
- if the connection cannot be closedpublic abstract java.sql.ResultSet querySQL(java.lang.String query) throws java.sql.SQLException, java.lang.ClassNotFoundException
query
- Query to be runjava.sql.SQLException
- If the query cannot be executedjava.lang.ClassNotFoundException
- If the driver cannot be found; see
openConnection()
public abstract int updateSQL(java.lang.String query) throws java.sql.SQLException, java.lang.ClassNotFoundException
Statement.executeUpdate(String)
query
- Query to be runStatement.executeUpdate(String)
java.sql.SQLException
- If the query cannot be executedjava.lang.ClassNotFoundException
- If the driver cannot be found; see
openConnection()