|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.ic.doc.automed.util.db.DBAccess
public abstract class DBAccess
Field Summary | |
---|---|
protected java.util.Map |
connections
|
protected java.lang.String |
dbFQPath
|
protected java.lang.String |
password
|
protected java.util.Properties |
props
|
protected java.lang.String |
user
|
Constructor Summary | |
---|---|
DBAccess(java.lang.String dbFQPath,
java.lang.String user,
java.lang.String password,
java.util.Properties props)
Creates a new instance of DBAccess |
Method Summary | |
---|---|
void |
closeConnection()
|
abstract void |
commit()
Only use this method if you want to commit changes immediately. |
protected void |
executeCommand(java.lang.String cmd)
Mostly used for executing control commands, e.g. |
abstract java.sql.ResultSet |
executeQuery(java.lang.String expression)
This method is used for SELECT statement |
abstract void |
executeStatement(java.lang.String expression)
This method is used for making changes to data, e.g. |
abstract java.sql.Connection |
getConnection()
|
java.util.Map |
getCurrentRow(java.sql.ResultSet rs)
Return current row in a result set as a HashMap of column->value. |
boolean |
isTableExist(java.lang.String name)
Checks whether or not a table exists in the database |
java.sql.Connection |
newConnection()
Creates a new connection to add to the pool |
void |
printResultSet(java.sql.ResultSet rs)
A generic implementation of debug-print of a result set |
abstract void |
setAutoCommit(boolean autoCommit)
Different data sources understands auto-commit differently. |
void |
shutdown()
Shutdown in-process database, closes current connection to it |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String dbFQPath
protected java.lang.String user
protected java.lang.String password
protected java.util.Properties props
protected java.util.Map connections
Constructor Detail |
---|
public DBAccess(java.lang.String dbFQPath, java.lang.String user, java.lang.String password, java.util.Properties props)
Method Detail |
---|
public java.sql.Connection newConnection() throws java.sql.SQLException
java.sql.SQLException
public abstract java.sql.Connection getConnection()
public void closeConnection()
public void shutdown() throws java.sql.SQLException
java.sql.SQLException
public abstract void setAutoCommit(boolean autoCommit) throws java.sql.SQLException
autoCommit
- a boolean
value: true = auto-commit; false otherwise
java.sql.SQLException
public abstract void commit() throws java.sql.SQLException
java.sql.SQLException
public boolean isTableExist(java.lang.String name) throws java.sql.SQLException
java.sql.SQLException
public java.util.Map getCurrentRow(java.sql.ResultSet rs) throws java.sql.SQLException
HashMap
of column->value.
java.sql.SQLException
public void printResultSet(java.sql.ResultSet rs) throws java.sql.SQLException
java.sql.SQLException
public abstract java.sql.ResultSet executeQuery(java.lang.String expression) throws java.sql.SQLException
expression
- is an SQL statement to use
ResultSet
object of the result data
java.sql.SQLException
public abstract void executeStatement(java.lang.String expression) throws java.sql.SQLException
expression
- is an SQL statement to use
java.sql.SQLException
protected void executeCommand(java.lang.String cmd) throws java.sql.SQLException
cmd
- the command to execute
java.sql.SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |