org.makumba.db.makumba
Class Table

java.lang.Object
  extended by org.makumba.db.makumba.Table
Direct Known Subclasses:
TableManager

public abstract class Table
extends Object

This is a generic database table RecordHandler. TODO Document the methods in here

Author:
Cristian Bogdan, Thomas Laroche, Marius Andra, Manuel Gay
See Also:
org.makumba.db.makumba.Database#getTable(org.makumba.abstr.RecordInfo)

Field Summary
(package private) static int BAR
           
(package private)  Database db
           
protected  DataDefinition dd
           
(package private)  DataTransformer insertHook
           
(package private)  Hashtable<String,DataDefinition> relatedTables
           
(package private)  String selectAllWithDbsv
           
(package private)  Object[] selectLimits
           
 
Constructor Summary
Table()
           
 
Method Summary
abstract  boolean canAdmin()
          does the table exist in the database ?
abstract  void checkInsert(Dictionary<String,Object> fieldsToCheck, Dictionary<String,DataHolder> fieldsToIgnore, Dictionary<String,Object> allFields)
           
abstract  void checkUpdate(Pointer pointer, Dictionary<String,Object> allFields)
           
abstract  void close()
           
(package private)  void computeInsertHook()
           
(package private)  void copyFrom(DBConnection dest, Table source, DBConnection sourceDB, boolean ignoreDbsv)
          TODO: makumba now supports query limitation (limit and offset). so this method (copyFrom) could run a number of queries per table (instead of one query per table), limited to say 100 records each so we don't have memory problems when the db is very big
abstract  int deleteFrom(DBConnection here, DBConnection source, boolean ignoreDbsv)
          delete all the records created within the indicated database and return their number
abstract  boolean exists()
          does the table exist in the database ?
abstract  boolean exists(String fieldName)
          does the field exist in the database ?
abstract  void findDuplicates(DBConnection c, Dictionary<String,Object> d)
          finds duplicates in the database, given a dictionary of data to insert/update
 Database getDatabase()
          What database does this table belong to
 DataDefinition getDataDefinition()
           
 FieldDefinition getFieldDefinition(String fieldName)
           
 Table getRelatedTable(String field)
          get the related table for the field indicated by name (of any set or ptr type)
 Pointer insertRecord(DBConnection c, Dictionary<String,Object> d)
          insert a record, return the pointer to it
abstract  Pointer insertRecordImpl(DBConnection c, Dictionary<String,Object> d)
           
protected abstract  void open(Properties p, NameResolver nr)
          Prepares everything needed for database management. identifies the database adapter that will be used, the type of connection manager, etc.
protected  void setDataDefinition(DataDefinition dd)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dd

protected DataDefinition dd

db

Database db

relatedTables

Hashtable<String,DataDefinition> relatedTables

selectAllWithDbsv

String selectAllWithDbsv

selectLimits

Object[] selectLimits

BAR

static final int BAR
See Also:
Constant Field Values

insertHook

DataTransformer insertHook
Constructor Detail

Table

public Table()
Method Detail

getDatabase

public Database getDatabase()
What database does this table belong to


setDataDefinition

protected void setDataDefinition(DataDefinition dd)

getDataDefinition

public DataDefinition getDataDefinition()

getFieldDefinition

public FieldDefinition getFieldDefinition(String fieldName)

getRelatedTable

public Table getRelatedTable(String field)
get the related table for the field indicated by name (of any set or ptr type)


canAdmin

public abstract boolean canAdmin()
does the table exist in the database ?


exists

public abstract boolean exists()
does the table exist in the database ?


deleteFrom

public abstract int deleteFrom(DBConnection here,
                               DBConnection source,
                               boolean ignoreDbsv)
delete all the records created within the indicated database and return their number


exists

public abstract boolean exists(String fieldName)
does the field exist in the database ?


copyFrom

void copyFrom(DBConnection dest,
              Table source,
              DBConnection sourceDB,
              boolean ignoreDbsv)
TODO: makumba now supports query limitation (limit and offset). so this method (copyFrom) could run a number of queries per table (instead of one query per table), limited to say 100 records each so we don't have memory problems when the db is very big


open

protected abstract void open(Properties p,
                             NameResolver nr)
Prepares everything needed for database management. identifies the database adapter that will be used, the type of connection manager, etc. Might call create. Looks if secondary tables (from a one-to-many, sets) need to be opened or created. Looks if the opened database actually respects the org.makumba file (if not, provides functionality to convert the database to the new format). Toto: Your brain is a mess where your stupidity is swimming.


computeInsertHook

void computeInsertHook()

close

public abstract void close()

insertRecord

public Pointer insertRecord(DBConnection c,
                            Dictionary<String,Object> d)
insert a record, return the pointer to it


insertRecordImpl

public abstract Pointer insertRecordImpl(DBConnection c,
                                         Dictionary<String,Object> d)

checkInsert

public abstract void checkInsert(Dictionary<String,Object> fieldsToCheck,
                                 Dictionary<String,DataHolder> fieldsToIgnore,
                                 Dictionary<String,Object> allFields)

checkUpdate

public abstract void checkUpdate(Pointer pointer,
                                 Dictionary<String,Object> allFields)

findDuplicates

public abstract void findDuplicates(DBConnection c,
                                    Dictionary<String,Object> d)
finds duplicates in the database, given a dictionary of data to insert/update