|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.synex.xml.db.DBManagerImpl
Default implementation of the DBManager interface. This class provides default implementations for all of the callbacks in the core database manager class DBManager.
Constructor Summary | |
DBManagerImpl()
Creates new DBManagerImpl |
Method Summary | |
java.util.Map |
addRow(java.lang.String tableName,
java.util.Map ids,
java.util.Map fields)
Adds a new record. |
void |
close()
Releases a database and JDBC resources immediately instead of waiting for them to be automatically released. |
protected java.lang.String |
createID(java.lang.String tableName,
java.lang.String keyName)
Creates a new primary key |
void |
deleteRow(java.lang.String tableName,
java.util.Map ids,
java.util.Map fields)
Deletes an existed record. |
void |
flush()
Flushes this database connection. |
void |
open(java.lang.String driver,
java.lang.String url,
java.lang.String user,
java.lang.String password)
Attempts to establish a connection to the given database URL. |
protected void |
setParameter(java.sql.PreparedStatement pstmt,
int index,
int type,
java.lang.String value)
Invokes the proper setXXX method |
void |
updateRow(java.lang.String tableName,
java.util.Map ids,
java.util.Map fields)
Updates an existed record. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DBManagerImpl()
Method Detail |
public void open(java.lang.String driver, java.lang.String url, java.lang.String user, java.lang.String password) throws DBManagerException
open
in interface DBManager
driver
- the new JDBC Driverurl
- a database url of the form jdbc:subprotocol:subnameuser
- the database user on whose behalf the connection is being madepassword
- the user's passwordDBManagerException
- Any database exception, possibly wrapping another exception.public void flush() throws DBManagerException
flush
in interface DBManager
DBManagerException
- Any database exception, possibly wrapping another exception.public void close() throws DBManagerException
close
in interface DBManager
DBManagerException
- Any database exception, possibly wrapping another exception.public java.util.Map addRow(java.lang.String tableName, java.util.Map ids, java.util.Map fields) throws DBManagerException
addRow
in interface DBManager
ids
- the list of primary keys (name/value pairs)fields
- the list of fields (name/value pairs)tableName
- the name of the tableDBManagerException
- Any database exception, possibly wrapping another exception.public void updateRow(java.lang.String tableName, java.util.Map ids, java.util.Map fields) throws DBManagerException
updateRow
in interface DBManager
ids
- the list of primary keys (name/value pairs)fields
- the list of fields (name/value pairs)tableName
- the name of the tableDBManagerException
- Any database exception, possibly wrapping another exception.public void deleteRow(java.lang.String tableName, java.util.Map ids, java.util.Map fields) throws DBManagerException
deleteRow
in interface DBManager
tableName
- the name of the tableids
- the list of primary keys (name/value pairs)fields
- the list of fields (name/value pairs)DBManagerException
- Any database exception, possibly wrapping another exception.protected java.lang.String createID(java.lang.String tableName, java.lang.String keyName) throws java.sql.SQLException
tableName
- the name of the tablekeyName
- the name of the primary keySQLException
- if a database access error occursprotected void setParameter(java.sql.PreparedStatement pstmt, int index, int type, java.lang.String value) throws java.sql.SQLException
pstmt
- an object that represents a precompiled SQL statementindex
- the first parameter is 1, the second is 2, ...type
- JDBC typevalue
- the parameter valueSQLException
- if a database access error occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 2002 Sergey Yakovlev, All Rights Reserved.