|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdb.RDB
public class RDB
Interface with the RDBMS. Currently only supports PostgreSQL (8.4 or later).
Constructor Summary | |
---|---|
RDB(java.lang.String url,
java.lang.String user,
java.lang.String password)
Specifies a JDBC connection. |
Method Summary | |
---|---|
void |
analyze(java.lang.String rel)
Analyze a specific table. |
java.lang.Double |
callFunctionDouble(java.lang.String func,
java.lang.String args)
Call a function that returns a double. |
void |
callProcedure(java.lang.String proc)
Call a stored procedure that doesn't have any parameters. |
void |
close()
Close this connection. |
void |
commit()
Commit the previous actions. |
void |
copyTable(java.lang.String src,
java.lang.String dest)
Copy the tuples of a table to another. |
long |
countTuples(java.lang.String table)
Count the tuples in a table. |
void |
createConstantTable(java.util.Hashtable<java.lang.String,java.lang.Integer> mapConstantID)
Store the symbol-ID mapping into a symbol table. |
void |
createSetTable(java.lang.String rel,
java.util.HashSet<java.lang.Integer> set)
Create a table to store a set of integers |
void |
disableAutoCommitForNow()
Disable auto-commit so that JDBC won't fetch all query results at once. |
void |
dropIndex(java.lang.String idx)
Drop an index if it exists. |
boolean |
dropSchema(java.lang.String sch)
Try to drop a schema; remain silent if the specified schema doesn't exist. |
void |
dropSequence(java.lang.String seq)
Try to drop a sequence; remain silent if the specified sequence doesn't exist. |
void |
dropTable(java.lang.String rel)
Try to drop a table; remain silent if the specified table doesn't exist. |
void |
execute(java.lang.String sql)
Execute a SQL statement (query/update). |
java.lang.String |
explain(java.lang.String sql)
Explain a SQL query with an execution plan. |
java.sql.Connection |
getConnection()
Return the database connection. |
int |
getLastUpdateRowCount()
Return the number of affected tuples from last update. |
java.sql.PreparedStatement |
getPrepareStatement(java.lang.String sql)
Return a prepared statement of the given SQL statement. |
static RDB |
getRDBbyConfig()
Attempt to establish the connection as specified in the (deault) configuration. |
int |
getSequenceCurValue(java.lang.String seq)
Read the current value of a sequence. |
java.util.HashMap<java.lang.Integer,java.lang.String> |
loadIdSymbolMapFromTable()
Load the symbol table into a hash table mapping symbol IDs to the original symbols. |
java.util.HashMap<java.lang.String,java.lang.Integer> |
loadSymbolIdMapFromTable()
Load the symbol table into a hash table mapping symbols to their IDs. |
java.sql.ResultSet |
query(java.lang.String sql)
Execute a SQL query. |
void |
resetSchema(java.lang.String schema)
Reset the database schema that serves as Tuffy's workspace. |
void |
resetSequence(java.lang.String seq)
Reset the value of a sequence to 1. |
void |
restoreAutoCommitState()
Restore the auto-commit state saved by disableAutoCommitForNow() . |
void |
setAutoCommit(boolean v)
Set auto-commit state of this connection. |
int |
update(java.lang.String sql)
Execute an update SQL statement. |
boolean |
updateBatch(java.util.ArrayList<java.lang.String> sqls)
Execute a set of update SQL statements as a batch. |
void |
vacuum(java.lang.String rel)
Vacuum a specific table. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RDB(java.lang.String url, java.lang.String user, java.lang.String password)
Method Detail |
---|
public void analyze(java.lang.String rel)
rel
- name of the tablepublic java.lang.Double callFunctionDouble(java.lang.String func, java.lang.String args)
func
- name of the functionargs
- arguments in the form of a string
public void callProcedure(java.lang.String proc)
proc
- name of the stored procedurepublic void close()
public void commit()
public void copyTable(java.lang.String src, java.lang.String dest)
src
- name of the source tabledest
- name the destination table; will be dropped if already existspublic long countTuples(java.lang.String table)
public void createConstantTable(java.util.Hashtable<java.lang.String,java.lang.Integer> mapConstantID)
mapConstantID
- the symbol-ID mappingConfig.relConstants
public void createSetTable(java.lang.String rel, java.util.HashSet<java.lang.Integer> set)
rel
- the name of the tableset
- the set of integerspublic void disableAutoCommitForNow()
restoreAutoCommitState()
to
restore the initial auto-commit state.
restoreAutoCommitState()
,
PostgreSQL's JDBC docpublic void dropIndex(java.lang.String idx)
idx
- name of the indexpublic boolean dropSchema(java.lang.String sch)
public void dropSequence(java.lang.String seq)
public void dropTable(java.lang.String rel)
public void execute(java.lang.String sql)
public java.lang.String explain(java.lang.String sql)
sql
- public java.sql.Connection getConnection()
public int getLastUpdateRowCount()
public java.sql.PreparedStatement getPrepareStatement(java.lang.String sql)
public static RDB getRDBbyConfig()
public int getSequenceCurValue(java.lang.String seq)
seq
- the name of the sequencepublic java.util.HashMap<java.lang.Integer,java.lang.String> loadIdSymbolMapFromTable()
Config.relConstants
public java.util.HashMap<java.lang.String,java.lang.Integer> loadSymbolIdMapFromTable()
Config.relConstants
public java.sql.ResultSet query(java.lang.String sql)
sql
- the SQL statement
public void resetSchema(java.lang.String schema)
Config.db_schema
public void resetSequence(java.lang.String seq)
seq
- name of the sequencepublic void restoreAutoCommitState()
disableAutoCommitForNow()
.
disableAutoCommitForNow()
public void setAutoCommit(boolean v)
public int update(java.lang.String sql)
public boolean updateBatch(java.util.ArrayList<java.lang.String> sqls)
public void vacuum(java.lang.String rel)
rel
- name of the table
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |