DbInterface

Represents a connection to a (real or simulated) database.

Methods
void commit()
Commit a pending transaction.
void commit() throws SQLException
Commit a pending transaction.
void connect()
Connect to the database.
void connect() throws Exception
Connect to the database.
void createIndex(Index index)
Create an index.
void createIndex(Index index) throws SQLException
Create an index.
Parameters:
index - the index to create
void createTable(Table table)
Create the specified table.
void createTable(Table table) throws SQLException
Create the specified table.
Parameters:
table - the table to create
Result delete(Table table, String condition)
Delete a number of rows.
Result delete(Table table, String condition) throws SQLException
Delete a number of rows.
Parameters:
table - the table
condition - the condition
Returns:
the result
void disconnect()
Disconnect from the database.
void disconnect() throws SQLException
Disconnect from the database.
void dropIndex(Index index)
Drop an index.
void dropIndex(Index index) throws SQLException
Drop an index.
Parameters:
index - the index to drop
void dropTable(Table table)
Drop the specified table.
void dropTable(Table table) throws SQLException
Drop the specified table.
Parameters:
table - the table to drop
void end()
Close the connection and the database.
void end() throws SQLException
Close the connection and the database.
Result insert(Table table, Column[] c, Value[] v)
Insert a row into a table.
Result insert(Table table, Column[] c, Value[] v) throws SQLException
Insert a row into a table.
Parameters:
table - the table
c - the column list
v - the values
Returns:
the result
void reset()
Drop all objects in the database.
void reset() throws SQLException
Drop all objects in the database.
void rollback()
Roll back a pending transaction.
void rollback() throws SQLException
Roll back a pending transaction.
Result select(String sql)
Execute a query.
Result select(String sql) throws SQLException
Execute a query.
Parameters:
sql - the SQL statement
Returns:
the result
void setAutoCommit(boolean b)
Enable or disable autocommit.
void setAutoCommit(boolean b) throws SQLException
Enable or disable autocommit.
Parameters:
b - the new value
Result update(Table table, Column[] columns, Value[] values, String condition)
Update the given table with the new values.
Result update(Table table, Column[] columns, Value[] values, String condition) throws SQLException
Update the given table with the new values.
Parameters:
table - the table
columns - the columns to update
values - the new values
condition - the condition
Returns:
the result of the update