org.javaWebGen.data
Class HSQLDataManager

java.lang.Object
  extended by org.javaWebGen.data.HSQLDataManager
All Implemented Interfaces:
DataManager

public class HSQLDataManager
extends java.lang.Object
implements DataManager

Handles talking to an HSQL embedded DataBase

Author:
Kevin Scott

Field Summary
 java.lang.String BIG_DECIMAL
           
 java.lang.String DATE
           
 java.lang.String INT
           
 java.lang.String LONG
           
 java.lang.String OBJECT
           
 java.lang.String STRING
           
 java.lang.String TIMESTAMP
           
 
Constructor Summary
HSQLDataManager()
           
 
Method Summary
 void close(java.sql.Connection con)
          close this connection ignoring any errors
 void endTransaction(java.sql.Connection con)
          commit transaction
 java.lang.String formatDate(java.util.Date date)
          get a String of a date object in the databases native format useful for doing updates etc..
 java.sql.Connection getConnection()
          get db connection
 java.util.Date getDate(java.lang.String dateStr)
          get a date object by parsing a string the databases native format useful for doing updates etc..
 int getNextValue(java.sql.Connection con, java.lang.String tablename)
          get next value for the primary key
 int getNextValue(java.lang.String tablename)
          get next value for the primary key
 Sequence getSequence()
           
 java.lang.String getSqlText(java.lang.String text)
          get a String that is escaped (handles ') hssql likes \' not ''
 java.lang.String[] getTableList()
           
 void init()
           
 void rollbackTransaction(java.sql.Connection con)
          rollback uncommited data ignoring any errors
 void setDriverClass(java.lang.String name)
          used to change the default database driver
 void setReader(PropertiesReader propReader)
          set db properties reader
 void setSequence(Sequence seq)
          Use this sequence generator NOTE this should not be used by a calling class
 void startTransaction(java.sql.Connection con)
          start Db tranacton
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BIG_DECIMAL

public final java.lang.String BIG_DECIMAL
See Also:
Constant Field Values

LONG

public final java.lang.String LONG
See Also:
Constant Field Values

INT

public final java.lang.String INT
See Also:
Constant Field Values

STRING

public final java.lang.String STRING
See Also:
Constant Field Values

OBJECT

public final java.lang.String OBJECT
See Also:
Constant Field Values

DATE

public final java.lang.String DATE
See Also:
Constant Field Values

TIMESTAMP

public final java.lang.String TIMESTAMP
See Also:
Constant Field Values
Constructor Detail

HSQLDataManager

public HSQLDataManager()
Method Detail

setReader

public void setReader(PropertiesReader propReader)
set db properties reader

Specified by:
setReader in interface DataManager
Parameters:
propReader - data base properties reader

setDriverClass

public void setDriverClass(java.lang.String name)
used to change the default database driver

Parameters:
name - of class of driver

getSequence

public Sequence getSequence()
Specified by:
getSequence in interface DataManager

setSequence

public void setSequence(Sequence seq)
Description copied from interface: DataManager
Use this sequence generator NOTE this should not be used by a calling class

Specified by:
setSequence in interface DataManager
Parameters:
seq - sequence object

init

public void init()
Specified by:
init in interface DataManager

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Description copied from interface: DataManager
get db connection

Specified by:
getConnection in interface DataManager
Throws:
java.sql.SQLException

close

public void close(java.sql.Connection con)
Description copied from interface: DataManager
close this connection ignoring any errors

Specified by:
close in interface DataManager
Parameters:
con - db connection

getNextValue

public int getNextValue(java.lang.String tablename)
                 throws DBException
Description copied from interface: DataManager
get next value for the primary key

Specified by:
getNextValue in interface DataManager
Parameters:
tablename - table name
Throws:
DBException

getNextValue

public int getNextValue(java.sql.Connection con,
                        java.lang.String tablename)
                 throws java.sql.SQLException
Description copied from interface: DataManager
get next value for the primary key

Specified by:
getNextValue in interface DataManager
Parameters:
con - db connection
tablename - table name
Throws:
java.sql.SQLException

startTransaction

public void startTransaction(java.sql.Connection con)
                      throws java.sql.SQLException
Description copied from interface: DataManager
start Db tranacton

Specified by:
startTransaction in interface DataManager
Parameters:
con - db connection
Throws:
java.sql.SQLException

endTransaction

public void endTransaction(java.sql.Connection con)
                    throws java.sql.SQLException
commit transaction

Specified by:
endTransaction in interface DataManager
Parameters:
con - db connection
Throws:
java.sql.SQLException

rollbackTransaction

public void rollbackTransaction(java.sql.Connection con)
Description copied from interface: DataManager
rollback uncommited data ignoring any errors

Specified by:
rollbackTransaction in interface DataManager
Parameters:
con - db connection

formatDate

public java.lang.String formatDate(java.util.Date date)
get a String of a date object in the databases native format useful for doing updates etc.. when not using databean objects hsql uses YYYY-MM-DD by default

Specified by:
formatDate in interface DataManager
Parameters:
date - to convert
Returns:
date string the database understands

getDate

public java.util.Date getDate(java.lang.String dateStr)
                       throws java.text.ParseException
get a date object by parsing a string the databases native format useful for doing updates etc.. when not using databean objects hsql uses YYYY-MM-DD by default

Specified by:
getDate in interface DataManager
Parameters:
dateStr - date text
Returns:
date object
Throws:
java.text.ParseException

getSqlText

public java.lang.String getSqlText(java.lang.String text)
get a String that is escaped (handles ') hssql likes \' not ''

Specified by:
getSqlText in interface DataManager
Parameters:
text - input text
Returns:
sql text

getTableList

public java.lang.String[] getTableList()
Specified by:
getTableList in interface DataManager
Returns:
list of current tables


Copyright(C) 2003-2006 Kevin Scott - All Rights Reserved.