public class SQLite extends Database
Constructor and Description |
---|
SQLite(org.bukkit.plugin.Plugin plugin,
java.lang.String dbLocation)
Creates a new SQLite instance
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkConnection()
Checks if a connection is open with the database
|
boolean |
closeConnection()
Closes the connection with the database
|
java.sql.Connection |
getConnection()
Gets the connection with the database
|
java.sql.Connection |
openConnection()
Opens a connection with the database
|
java.sql.ResultSet |
querySQL(java.lang.String query)
Executes a SQL Query
If the connection is closed, it will be opened |
int |
updateSQL(java.lang.String query)
Executes an Update SQL Query
See Statement.executeUpdate(String) If the connection is closed, it will be opened |
public SQLite(org.bukkit.plugin.Plugin plugin, java.lang.String dbLocation)
plugin
- Plugin instancedbLocation
- Location of the Database (Must end in .db)public java.sql.Connection openConnection() throws java.sql.SQLException, java.lang.ClassNotFoundException
Database
openConnection
in
class Database
java.sql.SQLException
- if the connection can not be openedjava.lang.ClassNotFoundException
- if the driver cannot be foundpublic boolean checkConnection() throws java.sql.SQLException
Database
checkConnection
in
class Database
java.sql.SQLException
- if the connection cannot be checkedpublic java.sql.Connection getConnection()
Database
getConnection
in
class Database
public boolean closeConnection() throws java.sql.SQLException
Database
closeConnection
in
class Database
java.sql.SQLException
- if the connection cannot be closedpublic java.sql.ResultSet querySQL(java.lang.String query) throws java.sql.SQLException, java.lang.ClassNotFoundException
Database
querySQL
in
class Database
query
- Query to be runjava.sql.SQLException
- If the query cannot be executedjava.lang.ClassNotFoundException
- If the driver cannot be found; see
Database.openConnection()
public int updateSQL(java.lang.String query) throws java.sql.SQLException, java.lang.ClassNotFoundException
Database
Statement.executeUpdate(String)
updateSQL
in
class Database
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
Database.openConnection()