Package wbs.utils.util.database
Class WbsDatabase
java.lang.Object
wbs.utils.util.database.WbsDatabase
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanCreate a database if it doesn't already exist under the given plugin's folderbooleanboolean@Nullable WbsField@Nullable WbsTable@Nullable ResultSetbooleanqueryWithoutReturns(String query) select(PreparedStatement query) Runs a query directly, auto-closing the connection used and returning a list of WbsRecords from the results of the query.
-
Constructor Details
-
WbsDatabase
-
-
Method Details
-
addTable
-
getTable
-
getDatabasePath
-
getDatabaseFilePath
-
databaseExists
public boolean databaseExists() -
createDatabase
public boolean createDatabase()Create a database if it doesn't already exist under the given plugin's folder- Returns:
- True if the database exists (regardless of if it was created or not). False if it didn't exist and failed to create.
-
createTables
public boolean createTables() -
select
@NotNull public @NotNull List<WbsRecord> select(PreparedStatement query) throws WbsDatabaseException Runs a query directly, auto-closing the connection used and returning a list of WbsRecords from the results of the query.This method does not close the given statement automatically.
- Parameters:
query- The prepared statement to run.- Returns:
- A list of the results which may be empty. The list will also be empty if an SQL exception is thrown during the query, but the exception will not be thrown.
- Throws:
WbsDatabaseException- If the WbsRecord was not able to be created from the ResultSet retrieved, which may occur if a field was created/retrieved without a corresponding WbsField in any table.
-
query
-
queryWithoutReturns
-
getField
-
getConnection
-
getPlugin
-