public interface DatabaseInterface extends Module
Modifier and Type | Interface and Description |
---|---|
static interface |
DatabaseInterface.DatabaseConnectionListener |
static interface |
DatabaseInterface.PreparedDatabaseStatement
A class that holds information about a stored database statement that
can be executed later, possibly multiple times.
|
static class |
DatabaseInterface.Row
A simple helper class for a single returned row, essentially just a HashMap.
|
static class |
DatabaseInterface.Rows
A simple helper class for returned rows, essentially an ArrayList of Row
objects.
|
Modifier and Type | Method and Description |
---|---|
void |
addDatabaseConnectionListener(DatabaseInterface.DatabaseConnectionListener l)
Adds a database connection listener that will be notified when
a database connection is established or closed.
|
java.lang.String |
formatTimestamp(long time)
Makes a time stamp value out of a milliseconds time.
|
java.lang.Object |
insertAutoIncrement(java.lang.String query)
Inserts a row with an auto increment field and returns the
automatically assigned value.
|
DatabaseInterface.PreparedDatabaseStatement |
prepareStatement(java.lang.String query)
Prepares a statement for later execution.
|
DatabaseInterface.Rows |
query(java.lang.String query)
Executes a database query and returns the results.
|
void |
removeDatabaseConnectionListener(DatabaseInterface.DatabaseConnectionListener l)
Removes a database connection listener.
|
java.lang.String |
sqlEscape(java.lang.String str)
Escapes a string so that it can then be safely used as part of a
query.
|
java.lang.String |
sqlEscapeLen(java.lang.String str,
int length)
Escapes a string so that it can then be safely used as part of a
query with a maximum length of the returned string.
|
int |
update(java.lang.String query)
Executes an update statement.
|
getDependencies, init, isInitialized, isRunning, start, stop
DatabaseInterface.Rows query(java.lang.String query) throws java.sql.SQLException
query
- The query to execute.java.sql.SQLException
int update(java.lang.String query) throws java.sql.SQLException
query
- The update statement to execute.java.sql.SQLException
java.lang.Object insertAutoIncrement(java.lang.String query) throws java.sql.SQLException
query
- The insert statement.java.sql.SQLException
java.lang.String sqlEscape(java.lang.String str)
str
- The string to be escaped.java.lang.String sqlEscapeLen(java.lang.String str, int length)
str
- The string to be escaped.length
- The maximum length.java.lang.String formatTimestamp(long time)
time
- The time in milliseconds.DatabaseInterface.PreparedDatabaseStatement prepareStatement(java.lang.String query) throws java.sql.SQLException
query
- The statement to prepare.java.sql.SQLException
void addDatabaseConnectionListener(DatabaseInterface.DatabaseConnectionListener l)
l
- void removeDatabaseConnectionListener(DatabaseInterface.DatabaseConnectionListener l)
l
- Copyright 2004-2015 Wandora Team