com.alarexgroup.m2mplf.db
Class Table

java.lang.Object
  extended by com.alarexgroup.m2mplf.db.Table
public final class Table
extends java.lang.Object

This class represents table in database. This class is used from Database.

Method Summary
 int addRecord(TableRecord t, boolean canBeDuplicity)
          Přidá řádek do tabulky
 void clearTable()
           
 TableRecord createRecord()
          Creates object of table's row
 void deleteRecord(int indexID, int indexPosition)
           
 void deleteRecord(TableRecord r)
           
 TableRecord findRecord(TableRecord what, int indexID)
          Finds record defined by index parameter "what" and returns his content - saved in table as TableRecord.
 void flush()
           
 TableRecord getFirst()
          Returns first row
 TableRecord getLast()
          Returns last row
 TableRecord getNextRecord()
          Returns next row or nulls
 TableRecord getPreviousRecord()
          Returns previous row or nulls
 int getRecords()
          Returns number of lines in table
protected  void init()
           
 void repackIndexes()
           
 int setQuery(int byIndex, TableRecord firstCond, TableRecord lastCond)
          Choose rows from table according index of row - must satisfy condition firstCond<=row<=lastCond.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRecords

public int getRecords()
Returns number of lines in table

Returns:
number of lines

createRecord

public TableRecord createRecord()
Creates object of table's row

Returns:
Returns object of table's row

findRecord

public TableRecord findRecord(TableRecord what,
                              int indexID)
Finds record defined by index parameter "what" and returns his content - saved in table as TableRecord. Only clumns from index definition are compared - from parameter "what". Other columns can be filled quite freely.

Parameters:
what - - looks for
indexID - - in which index
Returns:
row or null in the case of agreement

getNextRecord

public TableRecord getNextRecord()
Returns next row or nulls

Returns:
row content or null - in the case of no next row.

getPreviousRecord

public TableRecord getPreviousRecord()
Returns previous row or nulls

Returns:
row content or null - in the case of no previous row.

getFirst

public TableRecord getFirst()
Returns first row

Returns:
fow in TableRecord

getLast

public TableRecord getLast()
Returns last row

Returns:
row in TableRecord

setQuery

public int setQuery(int byIndex,
                    TableRecord firstCond,
                    TableRecord lastCond)
Choose rows from table according index of row - must satisfy condition firstCond<=row<=lastCond.
If firstCond and lastCond were NULL, selectes whole table.

Parameters:
byIndex - index array for choice
firstCond - first condition
lastCond - last condition
Returns:
number of selected rows

addRecord

public int addRecord(TableRecord t,
                     boolean canBeDuplicity)
Přidá řádek do tabulky

Parameters:
t - řádek
canBeDuplicity - povolení duplicitních řádků
Returns:
pozice řádku v indexu s ID = 0

deleteRecord

public void deleteRecord(TableRecord r)

deleteRecord

public void deleteRecord(int indexID,
                         int indexPosition)

repackIndexes

public void repackIndexes()

init

protected void init()

flush

public void flush()

clearTable

public void clearTable()