net.datacrow.core.db
Class DcDatabase

java.lang.Object
  extended by net.datacrow.core.db.DcDatabase

public class DcDatabase
extends java.lang.Object

Manages the Data Crow database. Is responsible for executing queries and database maintenance (upgrading).

Author:
Robert Jan van der Waals

Constructor Summary
DcDatabase()
           
 
Method Summary
protected  void cleanup()
          Removes unused columns.
protected  Conversions getConversions()
           
protected  java.lang.String getName()
          Returns the name of the database.
protected  Version getOriginalVersion()
          The version from before the upgrade.
protected  int getQueueSize()
          Returns the current count of queries waiting in the queue.
protected  Version getVersion(java.sql.Connection connection)
          Retrieves the current version of the database.
protected  void initiliaze()
          Initializes the database.
 boolean isNew()
           
protected  void queue(Query query)
          Adds a query to the query queue of this database.
protected  void setDbProperies(java.sql.Connection connection)
          Applies the default settings on the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DcDatabase

public DcDatabase()
Method Detail

getConversions

protected Conversions getConversions()

getOriginalVersion

protected Version getOriginalVersion()
The version from before the upgrade.


getVersion

protected Version getVersion(java.sql.Connection connection)
Retrieves the current version of the database. In case the database does not have a version number asigned an undetermined version number is returned.

Parameters:
connection -

isNew

public boolean isNew()

initiliaze

protected void initiliaze()
                   throws java.lang.Exception
Initializes the database. Upgrades are performed automatically; missing columns are added and missing tables are created.

Parameters:
connection -
Throws:
java.lang.Exception

cleanup

protected void cleanup()
Removes unused columns.


getQueueSize

protected int getQueueSize()
Returns the current count of queries waiting in the queue.


getName

protected java.lang.String getName()
Returns the name of the database.


queue

protected void queue(Query query)
Adds a query to the query queue of this database.

Parameters:
query -

setDbProperies

protected void setDbProperies(java.sql.Connection connection)
Applies the default settings on the database.

Parameters:
connection -