Package net.risingworld.api.database
Interface WorldDatabase
public interface WorldDatabase
Provides access to the current world database.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Represents a particular world database. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Executes the given SQL statement, for example a CREATE or DELETE statement.executeQuery
(String sql) Executes the given SQL statement and returns aResultSet
object.
Remember to close the ResultSet once you're ready.void
executeUpdate
(String sql) Executes the given SQL statement, which may be an INSERT, UPDATE or DELETE statement.Gets the database name.getPath()
Gets the path to the database file.
-
Method Details
-
getDatabaseType
DatabaseType getDatabaseType() -
getPath
String getPath()Gets the path to the database file.- Returns:
- the full path to the database file.
-
getDatabaseName
String getDatabaseName()Gets the database name.- Returns:
- the database name.
-
execute
Executes the given SQL statement, for example a CREATE or DELETE statement.
Please note: In order to synchronize any commits to the database, this statement may be executed with a minor delay (usually just a few ticks)- Parameters:
sql
- the SQL statement.- Example: Create a new table in world database
-
executeUpdate
Executes the given SQL statement, which may be an INSERT, UPDATE or DELETE statement.
Please note: In order to synchronize any commits to the database, this statement may be executed with a minor delay (usually just a few ticks)- Parameters:
sql
- the SQL statement, INSERT, UPDATE or DELETE.- Example: Delete a player from player database
-
executeQuery
Executes the given SQL statement and returns aResultSet
object.
Remember to close the ResultSet once you're ready.- Parameters:
sql
- the SQL statement, typically a SELECT statement.- Returns:
- a ResultSet object containing the data produced by the given SQL statement.
- Throws:
SQLException
- If a database access error occurs.- Example: Read player data from database
-