public class DataMain
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
DataMain.FileSorter |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
cacheDatabasePath
The default database that will be used if another isn't specified.
|
static int |
databasePort
The port the db will listen on.
|
static int |
DEFAULT_HYPERSONIC_PORT
The default Hypersonic database port (http://www.hsqldb.org/doc/guide/ch01.html)
|
static java.lang.String |
defaultDatabasePath
The default database that will be used if another isn't specified.
|
Constructor and Description |
---|
DataMain() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
backupDatabase()
Backs up the database.
|
static void |
closeConnection(boolean doCompact)
Manually closes the connection.
|
static void |
closeResultSet(java.sql.ResultSet rs)
Closes a ResultSet and associated cursors
|
static boolean |
databaseConnectionIsGood()
Tests the database connection.
|
static void |
deleteAllDatabaseBackupFolders()
Deletes all backup folders.
|
static void |
execute(java.lang.String sql)
Executes a generic SQL statement.
|
static void |
execute(java.lang.String sql,
java.lang.String databasePath)
Executes a generic SQL statement.
|
static void |
executeDelete(java.lang.String sql)
An alias for executeDelete(String, String) that uses the default database.
|
static void |
executeDelete(java.lang.String sql,
java.lang.String databasePath)
Executes a DELETE statement.
|
static int |
executeInsert(java.lang.String sql)
An alias for executeInsert(String, String) that uses the default database.
|
static int |
executeInsert(java.lang.String sql,
java.lang.String databasePath)
Executes an INSERT statement and returns the newly generated ID.
|
static java.sql.ResultSet |
executeSelect(java.lang.String sql)
An alias for executeSelect(String, String) that uses the default database.
|
static java.sql.ResultSet |
executeSelect(java.lang.String sql,
java.lang.String databasePath)
Given a SELECT SQL statement, this function executes the statement and returns the resulting ResultSet.
|
static void |
executeThrowable(java.lang.String sql)
Executes a statement, throwing an exception if one occurs.
|
static void |
executeThrowable(java.lang.String sql,
java.lang.String databasePath)
Executes a statement, throwing an exception if one occurs.
|
static java.sql.ResultSet |
executeThrowableSelect(java.lang.String sql)
An alias for executeSelect(String, String) that uses the default database and throws an exception.
|
static void |
executeUpdate(java.lang.String sql)
An alias for executeUpdate(String, String) that uses the default database.
|
static void |
executeUpdate(java.lang.String sql,
java.lang.String databasePath)
Executes an UPDATE statement.
|
static java.lang.String |
getSQLGlobalSearchSnippet(java.lang.String columnName,
java.lang.String textToFind,
boolean isCaseSensitive)
Gets a snippet of SQL used with the global search feature.
|
static boolean |
isConnected()
Indicates whether or not the class currently holds a connection to the database.
|
static boolean |
isReadOnly()
Indicates whether or not the database connection is ready-only.
|
static void |
setReadOnly(boolean isReadOnly)
Sets the connection read-only state of the connection.
|
static void |
startHypersonic()
Starts up the Hypersonic database in server mode, in a separate process.
|
static boolean |
verifyConnection()
Verifies whether or not the connection to the database is alive.
|
public static final java.lang.String defaultDatabasePath
public static final java.lang.String cacheDatabasePath
public static int DEFAULT_HYPERSONIC_PORT
public static int databasePort
public static boolean verifyConnection()
public static void closeConnection(boolean doCompact)
doCompact
- Indicates whether or not the database should be shut down as well as compacted.public static boolean databaseConnectionIsGood()
public static boolean isConnected()
public static void setReadOnly(boolean isReadOnly)
isReadOnly
- A boolean.public static boolean isReadOnly()
public static java.sql.ResultSet executeSelect(java.lang.String sql, java.lang.String databasePath)
sql
- The query to executedatabasePath
- The database path@Nullable public static java.sql.ResultSet executeSelect(java.lang.String sql)
sql
- The query to executepublic static java.sql.ResultSet executeThrowableSelect(java.lang.String sql) throws java.sql.SQLException
sql
- The SQL statement to execute.ResultSet
.java.sql.SQLException
- On error executing the sqlpublic static int executeInsert(java.lang.String sql, java.lang.String databasePath)
sql
- The query to executedatabasePath
- The database pathpublic static int executeInsert(java.lang.String sql)
sql
- The query to executepublic static void executeUpdate(java.lang.String sql, java.lang.String databasePath)
sql
- The query to executedatabasePath
- The database pathpublic static void executeUpdate(java.lang.String sql)
sql
- The query to executepublic static void execute(java.lang.String sql)
sql
- The statement to execute.public static void execute(java.lang.String sql, java.lang.String databasePath)
sql
- The statement to execute.databasePath
- The path to the database.public static void executeDelete(java.lang.String sql, java.lang.String databasePath)
sql
- The query to executedatabasePath
- The database pathpublic static void executeThrowable(java.lang.String sql) throws java.sql.SQLException
sql
- The query to executejava.sql.SQLException
- On error executing the sqlpublic static void executeThrowable(java.lang.String sql, java.lang.String databasePath) throws java.sql.SQLException
sql
- The query to executedatabasePath
- The database pathjava.sql.SQLException
- On error executing the sqlpublic static void executeDelete(java.lang.String sql)
sql
- The query to executepublic static void closeResultSet(@Nullable java.sql.ResultSet rs)
rs
- ResultSet to be closedpublic static void startHypersonic()
public static java.lang.String backupDatabase()
public static void deleteAllDatabaseBackupFolders()
public static java.lang.String getSQLGlobalSearchSnippet(java.lang.String columnName, @NotNull java.lang.String textToFind, boolean isCaseSensitive)
columnName
- The name of the column.textToFind
- The text to find.isCaseSensitive
- Case sensitive?