edu.sc.seis.fissuresUtil.database
Class JDBCUnit

java.lang.Object
  extended by edu.sc.seis.fissuresUtil.database.JDBCTable
      extended by edu.sc.seis.fissuresUtil.database.JDBCUnit

public class JDBCUnit
extends JDBCTable

JDBCUnit.java All methods are unsyncronized, the calling application should make sure that a single instance of this class is not accessed by more than one thread at a time. Because of the use of prepared statements and a single connection per instance, this class IS NOT THREAD-SAFE! Created: Tue Mar 21 12:39:50 2000


Field Summary
protected  java.util.HashMap cache
           
protected  java.sql.PreparedStatement getDBIdStmt
           
protected  java.sql.PreparedStatement getStmt
           
protected  java.sql.PreparedStatement putStmt
           
 
Fields inherited from class edu.sc.seis.fissuresUtil.database.JDBCTable
conn, tableName
 
Constructor Summary
JDBCUnit(java.sql.Connection conn)
           
 
Method Summary
protected  void createCache()
           
 edu.iris.Fissures.Unit get(int dbid)
           
 int getDBId(edu.iris.Fissures.Unit aUnit)
           
 int put(edu.iris.Fissures.model.UnitImpl aUnit)
          adds the unit to database
static edu.iris.Fissures.UnitBase stringToBase(java.lang.String inString)
           
 
Methods inherited from class edu.sc.seis.fissuresUtil.database.JDBCTable
getConnection, getTableName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

putStmt

protected java.sql.PreparedStatement putStmt

getDBIdStmt

protected java.sql.PreparedStatement getDBIdStmt

getStmt

protected java.sql.PreparedStatement getStmt

cache

protected java.util.HashMap cache
Constructor Detail

JDBCUnit

public JDBCUnit(java.sql.Connection conn)
         throws java.sql.SQLException
Throws:
java.sql.SQLException
Method Detail

get

public edu.iris.Fissures.Unit get(int dbid)
                           throws java.sql.SQLException,
                                  NotFound
Throws:
java.sql.SQLException
NotFound

put

public int put(edu.iris.Fissures.model.UnitImpl aUnit)
        throws java.sql.SQLException
adds the unit to database

Throws:
java.sql.SQLException

getDBId

public int getDBId(edu.iris.Fissures.Unit aUnit)
            throws java.sql.SQLException,
                   NotFound
Throws:
java.sql.SQLException
NotFound

stringToBase

public static final edu.iris.Fissures.UnitBase stringToBase(java.lang.String inString)

createCache

protected void createCache()
                    throws java.sql.SQLException
Throws:
java.sql.SQLException