Represents a database in the benchmark test application.
| Methods |
| static Database |
parse(Database.DatabaseTest test, int id, String dbString, int threadCount)
Parse a database configuration and create a database object from it.
|
| static Database |
parse(Database.DatabaseTest test, int id, String dbString, int threadCount)
Parse a database configuration and create a database object from it.
Parameters:
test - the test application
id - the database id
dbString - the configuration string
threadCount - the number of threads to use
Returns:
a new database object with the given settings
|
| void |
closeConnection()
Close the database connection.
|
| void |
closeConnection() throws SQLException
Close the database connection.
|
| void |
commit()
Commit a transaction.
|
| void |
commit() throws SQLException
Commit a transaction.
|
| void |
dropTable(String table)
Drop a table.
|
| void |
dropTable(String table)
Drop a table. Errors are ignored.
Parameters:
table - the table name
|
| void |
end()
This method is called when the test run ends.
|
| void |
end()
This method is called when the test run ends. This will stop collecting
data.
|
| int |
getExecutedStatements()
Get the number of executed statements.
|
| int |
getExecutedStatements()
Get the number of executed statements.
Returns:
the number of statements
|
| int |
getId()
Get the database id.
|
| int |
getId()
Get the database id.
Returns:
the id
|
| String |
getName()
Get the database name.
|
| String |
getName()
Get the database name.
Returns:
the database name
|
| Random |
getRandom()
Get the random number generator.
|
| Random |
getRandom()
Get the random number generator.
Returns:
the generator
|
| ArrayList |
getResults()
Get the result array.
|
| ArrayList |
getResults()
Get the result array.
Returns:
the result array
|
| int |
getThreadsCount()
|
| int |
getThreadsCount()
|
| int |
getTotalGCTime()
Get the total measured GC time.
|
| int |
getTotalGCTime()
Get the total measured GC time.
Returns:
the time in milliseconds
|
| int |
getTotalTime()
Get the total measured time.
|
| int |
getTotalTime()
Get the total measured time.
Returns:
the time
|
| void |
log(String action, String scale, int value)
If data collection is enabled, add this information to the log.
|
| void |
log(String action, String scale, int value)
If data collection is enabled, add this information to the log.
Parameters:
action - the action
scale - the scale
value - the value
|
| void |
logMemory(Bench bench, String action)
If data collection is enabled, add the currently used memory size to the
log.
|
| void |
logMemory(Bench bench, String action)
If data collection is enabled, add the currently used memory size to the
log.
Parameters:
bench - the benchmark
action - the action
|
| void |
openConnection()
Open the database connection.
|
| void |
openConnection() throws SQLException
Open the database connection.
|
| Connection |
openNewConnection()
Open a new database connection.
|
| Connection |
openNewConnection() throws SQLException
Open a new database connection. This connection must be closed
by calling conn.close().
Returns:
the opened connection
|
| PreparedStatement |
prepare(String sql)
Prepare a SQL statement.
|
| PreparedStatement |
prepare(String sql) throws SQLException
Prepare a SQL statement.
Parameters:
sql - the SQL statement
Returns:
the prepared statement
|
| ResultSet |
query(PreparedStatement prep)
Execute a query.
|
| ResultSet |
query(PreparedStatement prep) throws SQLException
Execute a query.
Parameters:
prep - the prepared statement
Returns:
the result set
|
| void |
queryReadResult(PreparedStatement prep)
Execute a query and read all rows.
|
| void |
queryReadResult(PreparedStatement prep) throws SQLException
Execute a query and read all rows.
Parameters:
prep - the prepared statement
|
| void |
rollback()
Roll a transaction back.
|
| void |
rollback() throws SQLException
Roll a transaction back.
|
| void |
setAutoCommit(boolean b)
Enable or disable auto-commit.
|
| void |
setAutoCommit(boolean b) throws SQLException
Enable or disable auto-commit.
Parameters:
b - false to disable
|
| void |
setTranslations(Properties prop)
Initialize the SQL statement translation of this database.
|
| void |
setTranslations(Properties prop)
Initialize the SQL statement translation of this database.
Parameters:
prop - the properties with the translations to use
|
| void |
start(Bench bench, String action)
Start the benchmark.
|
| void |
start(Bench bench, String action)
Start the benchmark.
Parameters:
bench - the benchmark
action - the action
|
| void |
startServer()
Start the server if the this is a remote connection.
|
| void |
startServer() throws Exception
Start the server if the this is a remote connection.
|
| void |
stopServer()
Stop the server if this is a remote connection.
|
| void |
stopServer() throws Exception
Stop the server if this is a remote connection.
|
| void |
trace(String action, int i, int max)
Print trace information if trace is enabled.
|
| void |
trace(String action, int i, int max)
Print trace information if trace is enabled.
Parameters:
action - the action
i - the current value
max - the maximum value
|
| void |
update(PreparedStatement prep, String traceMessage)
Execute an SQL statement.
|
| void |
update(PreparedStatement prep, String traceMessage) throws SQLException
Execute an SQL statement.
Parameters:
prep - the prepared statement
traceMessage - the trace message
|
| void |
update(String sql)
Execute an SQL statement.
|
| void |
update(String sql) throws SQLException
Execute an SQL statement.
Parameters:
sql - the SQL statement
|