to.etc.dbutil
Class BaseDB

java.lang.Object
  extended by to.etc.dbutil.BaseDB
Direct Known Subclasses:
MysqlDB, OracleDB, OranxoDB, PostgresDB, UnknownDB

public abstract class BaseDB
extends java.lang.Object


Constructor Summary
protected BaseDB()
           
 
Method Summary
protected abstract  java.lang.String getCheckString()
          Returns a SQL statement that is the cheapest way to check the validity of a connection.
protected abstract  int getFullSequenceID(java.sql.Connection dbc, java.lang.String tablename)
          Returns a sequence number that can be used to create a new PK for a record in the given table.
protected abstract  java.io.Reader getLobReader(java.sql.Connection dbc, java.sql.ResultSet rs, int col)
          Returns a Reader from the blob (clob) column specified.
protected abstract  java.io.Reader getLobReader(java.sql.Connection dbc, java.sql.ResultSet rs, java.lang.String col)
          Returns a Reader from the blob (clob) column specified.
protected abstract  java.io.InputStream getLobStream(java.sql.Connection dbc, java.sql.ResultSet rs, int col)
          Returns an InputStream from the blob (clob) column specified.
protected abstract  java.io.InputStream getLobStream(java.sql.Connection dbc, java.sql.ResultSet rs, java.lang.String col)
          Returns an InputStream from the blob (clob) column specified.
protected abstract  int getSequenceID(java.sql.Connection dbc, java.lang.String tablename)
          Returns a sequence number that can be used to create a new PK for a record in the given table.
 boolean oracleOuterJoin()
           
protected abstract  void setBlob(java.sql.Connection dbc, java.lang.String table, java.lang.String column, java.lang.String[] pkfields, java.lang.Object[] key, java.io.InputStream is)
           
protected  void setBlob(java.sql.Connection dbc, java.lang.String table, java.lang.String column, java.lang.String where, byte[][] data)
           
protected abstract  void setBlob(java.sql.Connection dbc, java.lang.String table, java.lang.String column, java.lang.String where, java.io.InputStream is)
          Writes a blob to the requested record.
protected abstract  void setClob(java.sql.Connection dbc, java.lang.String table, java.lang.String column, java.lang.String where, java.io.Reader r)
           
static int streamCopy(java.io.OutputStream os, java.io.InputStream is)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseDB

protected BaseDB()
Method Detail

getSequenceID

protected abstract int getSequenceID(java.sql.Connection dbc,
                                     java.lang.String tablename)
                              throws java.sql.SQLException
Returns a sequence number that can be used to create a new PK for a record in the given table. Sequences are emulated on databases that do not support 'm.

Parameters:
dbc -
tablename -
Returns:
Throws:
java.sql.SQLException

getFullSequenceID

protected abstract int getFullSequenceID(java.sql.Connection dbc,
                                         java.lang.String tablename)
                                  throws java.sql.SQLException
Returns a sequence number that can be used to create a new PK for a record in the given table. Sequences are emulated on databases that do not support 'm.

Parameters:
dbc -
tablename -
Returns:
Throws:
java.sql.SQLException

setBlob

protected abstract void setBlob(java.sql.Connection dbc,
                                java.lang.String table,
                                java.lang.String column,
                                java.lang.String where,
                                java.io.InputStream is)
                         throws java.sql.SQLException
Writes a blob to the requested record.

Throws:
java.sql.SQLException

setBlob

protected abstract void setBlob(java.sql.Connection dbc,
                                java.lang.String table,
                                java.lang.String column,
                                java.lang.String[] pkfields,
                                java.lang.Object[] key,
                                java.io.InputStream is)
                         throws java.sql.SQLException
Throws:
java.sql.SQLException

getCheckString

protected abstract java.lang.String getCheckString()
Returns a SQL statement that is the cheapest way to check the validity of a connection.

Returns:

streamCopy

public static int streamCopy(java.io.OutputStream os,
                             java.io.InputStream is)
                      throws java.io.IOException
Throws:
java.io.IOException

getLobReader

protected abstract java.io.Reader getLobReader(java.sql.Connection dbc,
                                               java.sql.ResultSet rs,
                                               int col)
                                        throws java.lang.Exception
Returns a Reader from the blob (clob) column specified.

Parameters:
rs -
col -
Returns:
Throws:
java.lang.Exception

getLobReader

protected abstract java.io.Reader getLobReader(java.sql.Connection dbc,
                                               java.sql.ResultSet rs,
                                               java.lang.String col)
                                        throws java.lang.Exception
Returns a Reader from the blob (clob) column specified.

Parameters:
rs -
col -
Returns:
Throws:
java.lang.Exception

getLobStream

protected abstract java.io.InputStream getLobStream(java.sql.Connection dbc,
                                                    java.sql.ResultSet rs,
                                                    int col)
                                             throws java.lang.Exception
Returns an InputStream from the blob (clob) column specified.

Parameters:
rs -
col -
Returns:
Throws:
java.lang.Exception

getLobStream

protected abstract java.io.InputStream getLobStream(java.sql.Connection dbc,
                                                    java.sql.ResultSet rs,
                                                    java.lang.String col)
                                             throws java.lang.Exception
Returns an InputStream from the blob (clob) column specified.

Parameters:
rs -
col -
Returns:
Throws:
java.lang.Exception

oracleOuterJoin

public boolean oracleOuterJoin()

setBlob

protected void setBlob(java.sql.Connection dbc,
                       java.lang.String table,
                       java.lang.String column,
                       java.lang.String where,
                       byte[][] data)
                throws java.sql.SQLException
Throws:
java.sql.SQLException

setClob

protected abstract void setClob(java.sql.Connection dbc,
                                java.lang.String table,
                                java.lang.String column,
                                java.lang.String where,
                                java.io.Reader r)
                         throws java.lang.Exception
Throws:
java.lang.Exception