|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.melati.poem.JdbcTable
public class JdbcTable
A Table.
| Constructor Summary | |
|---|---|
JdbcTable(Database database,
String name,
DefinitionSource definitionSource)
Constructor. |
|
| Method Summary | |
|---|---|
protected Column |
_getColumn(String nameP)
|
protected JdbcPersistent |
_newPersistent()
A freshly minted, and uninitialised, Persistent object for the table. |
Column |
addColumnAndCommit(ColumnInfo infoP)
Add a Column to the database and the TableInfo table. |
void |
addListener(TableListener listener)
Add a TableListener to this Table. |
void |
appendWhereClause(StringBuffer clause,
Persistent persistent)
Append an SQL logical expression to the given buffer to match rows according to criteria represented by the given object. |
CachedCount |
cachedCount(Persistent criteria)
|
CachedCount |
cachedCount(Persistent criteria,
boolean includeDeleted,
boolean excludeUnselectable)
A mechanism for caching a record count. |
CachedCount |
cachedCount(String whereClause)
A mechanism for caching a record count. |
CachedCount |
cachedCount(String whereClause,
boolean includeDeleted)
A mechanism for caching a record count. |
CachedCount |
cachedCount(String whereClause,
boolean includeDeleted,
boolean excludeUnselectable)
A mechanism for caching a record count. |
CachedExists |
cachedExists(String whereClause)
A mechanism for caching an existance. |
CachedSelection |
cachedSelection(String whereClause,
String orderByClause)
A mechanism for caching a selection of records. |
Field |
cachedSelectionField(String whereClause,
String orderByClause,
boolean nullable,
Integer selectedTroid,
String nameP)
Make up a Field object whose possible values are a selected subset of the records in the table. |
RestrictedReferencePoemType |
cachedSelectionType(String whereClause,
String orderByClause,
boolean nullable)
A mechanism for caching a record count. |
Column |
canDeleteColumn()
|
Column |
canReadColumn()
|
Column |
canSelectColumn()
|
Column |
canWriteColumn()
|
void |
clearColumnInfoCaches()
Clear caches. |
String |
cnfWhereClause(Enumeration persistents)
|
String |
cnfWhereClause(Enumeration persistents,
boolean includeDeleted,
boolean excludeUnselectable)
Return a Conjunctive Normal Form (CNF) where clause. |
Enumeration<Column> |
columns()
All the table's columns. |
Column |
columnWithColumnInfoID(int columnInfoID)
|
int |
count()
|
int |
count(String whereClause)
It is the programmer's responsibility to ensure that the where clause is suitable for the target DBMS. |
int |
count(String whereClause,
boolean includeDeleted)
It is the programmer's responsibility to ensure that the where clause is suitable for the target DBMS. |
int |
count(String whereClause,
boolean includeDeleted,
boolean excludeUnselectable)
It is the programmer's responsibility to ensure that the where clause is suitable for the target DBMS. |
String |
countSQL(String whereClause)
|
String |
countSQL(String fromClause,
String whereClause,
boolean includeDeleted,
boolean excludeUnselectable)
Return an SQL statement to count rows put together from the arguments. |
Persistent |
create(Initialiser initialiser)
Create a new object (record) in the table. |
void |
create(Persistent p)
Write a new row containing the given object. |
void |
createTableInfo()
Create the (possibly overridden) TableInfo if it has not yet been created. |
void |
dbAddConstraints()
Constraints are not used in POEM, but you might want to use them if exporting the db or using schema visualisation tools. |
void |
dbModifyStructure(String sql)
Use this for DDL statements, ie those which alter the structure of the db. |
protected Integer |
defaultCacheLimit()
|
protected String |
defaultCategory()
|
protected String |
defaultDescription()
The `factory-default' description for the table, or null if it doesn't have one. |
protected String |
defaultDisplayName()
The `factory-default' display name for the table. |
protected int |
defaultDisplayOrder()
|
String |
defaultOrderByClause()
If the troidColumn has yet to be set then returns an empty string. |
protected boolean |
defaultRememberAllTroids()
|
void |
defineColumn(Column column)
Don't call this in your application code. |
void |
delete_unsafe(String whereClause)
It is the programmer's responsibility to ensure that the where clause is suitable for the target DBMS. |
void |
delete(Integer troid,
PoemTransaction transaction)
The Transaction cannot be null, as this is trapped in #deleteLock(SessionToken). |
void |
deleteColumnAndCommit(ColumnInfo columnInfo)
|
Column |
deletedColumn()
|
Column |
displayColumn()
The table's primary display column, the Troid column if not set. |
Enumeration |
displayColumns(DisplayLevel level)
Return columns at a display level in display order. |
int |
displayColumnsCount(DisplayLevel level)
|
void |
dump()
Print information about the structure of the table to stdout. |
void |
dump(PrintStream ps)
Print information to PrintStream. |
void |
dumpCacheAnalysis()
Print some diagnostic information about the contents and consistency of POEM's cache for this table to stderr. |
boolean |
equals(Object t)
Make sure that two equal table objects have the same name. |
boolean |
exists(Persistent persistent)
|
boolean |
exists(String whereClause)
It is the programmer's responsibility to ensure that the where clause is suitable for the target DBMS. |
int |
extrasCount()
The number of `extra' (non-DSD-defined) columns in the table. |
Persistent |
firstSelection(String whereClause)
Get an object satisfying the where clause. |
Cache.Info |
getCacheInfo()
Enable reporting of the status of the cache. |
Capability |
getCanCreate()
The capability required for creating records in the table. |
TableCategory |
getCategory()
The category of this table. |
Column |
getColumn(String nameP)
The table's column with a given name. |
int |
getColumnsCount()
|
Database |
getDatabase()
The database to which the table is attached. |
String |
getDbmsTableType()
|
Capability |
getDefaultCanDelete()
The capability required for deleting records in the table, unless overridden in the record itself. |
Capability |
getDefaultCanRead()
The capability required for reading records from the table, unless overridden in the record itself. |
Capability |
getDefaultCanWrite()
The capability required for updating records in the table, unless overridden in the record itself. |
String |
getDescription()
A brief description of the table's function. |
Enumeration |
getDetailDisplayColumns()
The table's columns for detailed display in display order. |
int |
getDetailDisplayColumnsCount()
|
String |
getDisplayName()
The human-readable name of the table. |
String |
getDsdName()
Public method used in DSD.wm. |
TableInfo |
getInfo()
|
int |
getMostRecentTroid()
|
String |
getName()
The table's programmatic name. |
int |
getNextExtrasIndex()
|
Persistent |
getObject(int troid)
The object from the table with a given troid. |
Persistent |
getObject(Integer troid)
The object from the table with a given troid. |
Enumeration |
getRecordDisplayColumns()
The table's columns designated for display in a record, in display order. |
int |
getRecordDisplayColumnsCount()
|
Enumeration |
getSearchCriterionColumns()
The table's columns designated for use as search criteria, in display order. |
int |
getSearchCriterionColumnsCount()
|
Enumeration |
getSummaryDisplayColumns()
The table's columns designated for display in a record summary, in display order. |
int |
getSummaryDisplayColumnsCount()
|
TableInfo |
getTableInfo()
|
int |
hashCode()
Ensure tables can be used as hashtable keys. |
void |
init()
Override this to perform pre-unification initialisation. |
void |
invalidateTransactionStuffs()
When deleting a table and used in tests. |
void |
load(PoemTransaction transaction,
Persistent persistent)
|
Persistent |
newPersistent()
|
void |
notifyColumnInfo(ColumnInfo infoP)
Clears columnInfo caches, normally a no-op. |
void |
notifyTouched(PoemTransaction transaction,
Persistent persistent)
Notify the table that one if its records is about to be changed in a transaction. |
void |
postInitialise()
Do stuff immediately after table initialisation. |
Column |
primaryCriterionColumn()
In a similar manner to the primary display column, each table can have one primary criterion column. |
String |
quotedName()
|
void |
readLock()
Lock this record. |
Enumeration |
referencesTo(Persistent object)
All the objects in the table which refer to a given object. |
Enumeration |
referencesTo(Table table)
All the columns in the table which refer to the given table. |
void |
rememberAllTroids(boolean flag)
|
Enumeration<Persistent> |
selection()
All the objects in the table. |
Enumeration |
selection(Persistent criteria)
Return a selection of rows given an exemplar. |
Enumeration |
selection(Persistent criteria,
String orderByClause)
Return a selection of rows given arguments specifying a query. |
Enumeration |
selection(Persistent criteria,
String orderByClause,
boolean includeDeleted,
boolean excludeUnselectable)
Return a selection of rows given arguments specifying a query. |
Enumeration |
selection(String whereClause)
A SELECTion of objects from the table meeting given criteria. |
Enumeration<Persistent> |
selection(String whereClause,
String orderByClause,
boolean includeDeleted)
A SELECTion of objects from the table meeting given criteria, possibly including those flagged as deleted. |
String |
selectionSQL(String fromClause,
String whereClause,
String orderByClause,
boolean includeDeleted,
boolean excludeUnselectable)
The from clause has been added as an argument because it is inextricably linked to the where clause, but the default is quotedName(). |
long |
serial(PoemTransaction transaction)
|
void |
setCacheLimit(Integer limit)
|
void |
setDisplayColumn(Column column)
|
void |
setSearchColumn(Column column)
|
void |
setTableInfo(TableInfo tableInfo)
|
Integer |
tableInfoID()
The troid (id) of the table's entry in the tableinfo table. |
String |
toString()
A concise string to stand in for the table. |
void |
trimCache(int maxSize)
|
Column |
troidColumn()
The table's troid column. |
Integer |
troidFor(Persistent persistent)
|
Enumeration |
troidSelection(Persistent criteria,
String orderByClause,
boolean includeDeleted,
boolean excludeUnselectable,
PoemTransaction transaction)
|
Enumeration<Integer> |
troidSelection(String whereClause,
String orderByClause,
boolean includeDeleted)
A SELECTion of troids of objects from the table meeting given criteria. |
Enumeration<Integer> |
troidSelection(String whereClause,
String orderByClause,
boolean includeDeleted,
PoemTransaction transaction)
It is the programmer's responsibility to ensure that the where clause is suitable for the target DBMS. |
void |
uncache()
Invalidate table cache. |
void |
unifyWithColumnInfo()
Match columnInfo with this Table's columns. |
void |
unifyWithDB(ResultSet colDescs)
Unify the JDBC description of this table with the meta data held in the TableInfo |
String |
whereClause(Persistent criteria)
Return an SQL WHERE clause to select rows that match the non-null fields of the given object. |
String |
whereClause(Persistent criteria,
boolean includeDeleted,
boolean excludeUnselectable)
Return an SQL WHERE clause to select rows using the given object as a selection criteria and optionally deleted rows or those included rows the user is not capable of selecting. |
void |
writeDown(PoemTransaction transaction,
Persistent p)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JdbcTable(Database database,
String name,
DefinitionSource definitionSource)
| Method Detail |
|---|
public void postInitialise()
This base method clears the column info caches and adds a listener to the column info table to maintain the caches.
It may be overridden to perform other actions. For example to ensure required rows exist in tables that define numeric ID's for codes.
postInitialise in interface TablenotifyColumnInfo(ColumnInfo),
clearColumnInfoCaches()public final Database getDatabase()
getDatabase in interface Tablepublic final String getName()
getName in interface TableDbms.melatiName(String)public final String quotedName()
quotedName in interface Tablepublic final String getDisplayName()
getDisplayName in interface Tablepublic final String getDescription()
getDescription in interface Tablepublic final TableCategory getCategory()
getCategory in interface Tablepublic final TableInfo getInfo()
getInfo in interface TableTableInfo for this tablepublic final Integer tableInfoID()
tableInfoID in interface Table
public final Column getColumn(String nameP)
throws NoSuchColumnPoemException
getColumn in interface TablenameP - name of column to get
NoSuchColumnPoemException - if there is no column with that nameprotected final Column _getColumn(String nameP)
public final Enumeration<Column> columns()
columns in interface TableColumnpublic final int getColumnsCount()
getColumnsCount in interface Tablepublic Column columnWithColumnInfoID(int columnInfoID)
columnWithColumnInfoID in interface TablecolumnInfoID -
public final Column troidColumn()
troidColumn in interface TablegetObject(java.lang.Integer)public final Column deletedColumn()
deletedColumn in interface Tablepublic final Column displayColumn()
displayColumn in interface TableReferencePoemType._stringOfCooked(java.lang.Object, org.melati.poem.PoemLocale, int),
DisplayLevel.primarypublic final void setDisplayColumn(Column column)
setDisplayColumn in interface Tablecolumn - the display column to setpublic final Column primaryCriterionColumn()
The Primary Criterion is the main grouping field of the table, ie the most important non-unique type field.
For example the Primary Criterion for a User table might be Nationality.
primaryCriterionColumn in interface TableSearchabilitypublic void setSearchColumn(Column column)
setSearchColumn in interface Tablecolumn - the search column to setpublic String defaultOrderByClause()
defaultOrderByClause in interface Tablepublic void clearColumnInfoCaches()
clearColumnInfoCaches in interface Tablepublic void notifyColumnInfo(ColumnInfo infoP)
notifyColumnInfo in interface TableinfoP - the possibly null ColumnInfo meta-data persistentpublic final Enumeration displayColumns(DisplayLevel level)
displayColumns in interface Tablelevel - the DisplayLevel to select
public final int displayColumnsCount(DisplayLevel level)
displayColumnsCount in interface Tablelevel - the DisplayLevel to select
public final Enumeration getDetailDisplayColumns()
getDetailDisplayColumns in interface TableColumn,
displayColumns(DisplayLevel),
DisplayLevel.detailpublic final int getDetailDisplayColumnsCount()
getDetailDisplayColumnsCount in interface Tablepublic final Enumeration getRecordDisplayColumns()
getRecordDisplayColumns in interface TableColumn,
displayColumns(DisplayLevel),
DisplayLevel.recordpublic final int getRecordDisplayColumnsCount()
getRecordDisplayColumnsCount in interface Tablepublic final Enumeration getSummaryDisplayColumns()
getSummaryDisplayColumns in interface TableColumn,
displayColumns(DisplayLevel),
DisplayLevel.summarypublic final int getSummaryDisplayColumnsCount()
getSummaryDisplayColumnsCount in interface Tablepublic final Enumeration getSearchCriterionColumns()
getSearchCriterionColumns in interface TableColumnpublic final int getSearchCriterionColumnsCount()
getSearchCriterionColumnsCount in interface Table
public void dbModifyStructure(String sql)
throws StructuralModificationFailedPoemException
dbModifyStructure in interface Tablesql - the SQL DDL statement to execute
StructuralModificationFailedPoemExceptionpublic String getDbmsTableType()
getDbmsTableType in interface Tableorg.melati.poem.dbms.Hsqldb}public void dbAddConstraints()
dbAddConstraints in interface Tablepublic void invalidateTransactionStuffs()
invalidateTransactionStuffs in interface Table
public void load(PoemTransaction transaction,
Persistent persistent)
load in interface Tabletransaction - possibly null if working with the committed transactionpersistent - the Persistent to load
public void delete(Integer troid,
PoemTransaction transaction)
delete in interface Tabletroid - id of row to deletetransaction - a non-null transaction
public void writeDown(PoemTransaction transaction,
Persistent p)
writeDown in interface Tabletransaction - our PoemTransactionp - the Persistent to writepublic void uncache()
uncache in interface Tablepublic void trimCache(int maxSize)
trimCache in interface TablemaxSize - new maximum sizepublic Cache.Info getCacheInfo()
getCacheInfo in interface Tablepublic void addListener(TableListener listener)
TableListener to this Table.
addListener in interface Table
public void notifyTouched(PoemTransaction transaction,
Persistent persistent)
notifyTouched in interface Tabletransaction - the transaction in which the change will be madepersistent - the record to be changedpublic long serial(PoemTransaction transaction)
serial in interface Tablepublic void readLock()
readLock in interface Table
public Persistent getObject(Integer troid)
throws NoSuchRowPoemException
getObject in interface SelectablegetObject in interface Tabletroid - Every record (object) in a POEM database must have a
troid (table row ID, or table-unique non-nullable
integer primary key), often but not necessarily called
id, so that it can be conveniently `named' for
retrieval by this method.
NoSuchRowPoemException - if there is no row in the table with the given troidPersistable.getTroid()
public Persistent getObject(int troid)
throws NoSuchRowPoemException
getObject in interface Tabletroid - the table row id
NoSuchRowPoemException - if not foundgetObject(java.lang.Integer)
public String selectionSQL(String fromClause,
String whereClause,
String orderByClause,
boolean includeDeleted,
boolean excludeUnselectable)
quotedName().
It is the programmer's responsibility to ensure that the where clause
is suitable for the target DBMS.
selectionSQL in interface TablefromClause - Comma separated list of table names or null for default.whereClause - SQL fragmentorderByClause - Comma separated listincludeDeleted - Flag as to whether to include soft deleted recordsexcludeUnselectable - Whether to append unselectable exclusion SQL
public Enumeration<Integer> troidSelection(String whereClause,
String orderByClause,
boolean includeDeleted,
PoemTransaction transaction)
troidSelection in interface TableEnumeration of Troids satisfying the criteria.
public Enumeration troidSelection(Persistent criteria,
String orderByClause,
boolean includeDeleted,
boolean excludeUnselectable,
PoemTransaction transaction)
troidSelection in interface Tablecriteria - Represents selection criteria possibly on joined tablestransaction - A transaction or null for
PoemThread.transaction()
troidSelection(String, String, boolean, PoemTransaction)public void rememberAllTroids(boolean flag)
rememberAllTroids in interface Tableflag - whether to remember or forgetpublic void setCacheLimit(Integer limit)
setCacheLimit in interface Tablelimit - the limit to set
public Enumeration<Integer> troidSelection(String whereClause,
String orderByClause,
boolean includeDeleted)
throws SQLPoemException
troidSelection in interface TablewhereClause - an SQL snippetorderByClause - an SQL snippetincludeDeleted - whether to include deleted records, if any
SQLPoemExceptiongetObject(java.lang.Integer),
selection(java.lang.String, java.lang.String, boolean)
public Enumeration<Persistent> selection()
throws SQLPoemException
selection in interface Selectableselection in interface TableSQLPoemExceptionSelectable.selection()
public final Enumeration selection(String whereClause)
throws SQLPoemException
selection in interface TablewhereClause - SQL SELECTion criteria for the search:
the part that should appear after the
WHERE keyword
SQLPoemExceptionColumn.selectionWhereEq(java.lang.Object)public Persistent firstSelection(String whereClause)
firstSelection in interface TablewhereClause - SQL SELECTion criteria for the search:
the part that should appear after the
WHERE keyword
public Enumeration<Persistent> selection(String whereClause,
String orderByClause,
boolean includeDeleted)
throws SQLPoemException
selection in interface TableincludeDeleted - whether to return objects flagged as deleted
(ignored if the table doesn't have a
deleted column)
SQLPoemExceptionselection(java.lang.String)
public Enumeration selection(Persistent criteria)
throws SQLPoemException
selection in interface Tablecriteria - Represents selection criteria possibly on joined tables
SQLPoemExceptionselection(String, String, boolean)
public Enumeration selection(Persistent criteria,
String orderByClause)
throws SQLPoemException
selection in interface Tablecriteria - Represents selection criteria possibly on joined tablesorderByClause - Comma separated list
SQLPoemExceptionselection(String, String, boolean)
public Enumeration selection(Persistent criteria,
String orderByClause,
boolean includeDeleted,
boolean excludeUnselectable)
throws SQLPoemException
selection in interface Tablecriteria - Represents selection criteria possibly on joined tablesorderByClause - Comma separated listexcludeUnselectable - Whether to append unselectable exclusion SQL
SQLPoemExceptionselection(String, String, boolean)public String countSQL(String whereClause)
countSQL in interface TablewhereClause -
public String countSQL(String fromClause,
String whereClause,
boolean includeDeleted,
boolean excludeUnselectable)
countSQL in interface TablefromClause - Comma separated list of table names
public int count(String whereClause,
boolean includeDeleted,
boolean excludeUnselectable)
throws SQLPoemException
count in interface TableSQLPoemException
public int count(String whereClause,
boolean includeDeleted)
throws SQLPoemException
count in interface TableSQLPoemException
public int count(String whereClause)
throws SQLPoemException
count in interface TableSQLPoemException
public int count()
throws SQLPoemException
count in interface TableSQLPoemException
public boolean exists(String whereClause)
throws SQLPoemException
exists in interface TablewhereClause - the SQL criteria
SQLPoemExceptionpublic boolean exists(Persistent persistent)
exists in interface Tablepersistent - a Persistent with some fields filled in
public void appendWhereClause(StringBuffer clause,
Persistent persistent)
This default selects rows for which the non-null fields in the given object match, but subtypes may add other criteria.
The column names are now qualified with the table name so that subtypes can append elements of a join but there is no filtering by canselect columns.
appendWhereClause in interface TablenotifyColumnInfo(ColumnInfo),
clearColumnInfoCaches()public String whereClause(Persistent criteria)
This does not filter out any rows with a capability the user does not have in a canselect column, nor did it ever filter out rows deleted according to a "deleted" column. But the caller usually gets a second chance to do both.
whereClause in interface Table
public String whereClause(Persistent criteria,
boolean includeDeleted,
boolean excludeUnselectable)
This is currently implemented in terms of
appendWhereClause(StringBuffer, Persistent).
whereClause in interface Tablepublic String cnfWhereClause(Enumeration persistents)
cnfWhereClause in interface TablecnfWhereClause(Enumeration, boolean, boolean),
whereClause(Persistent)
public String cnfWhereClause(Enumeration persistents,
boolean includeDeleted,
boolean excludeUnselectable)
cnfWhereClause in interface Tablepublic Enumeration referencesTo(Persistent object)
It is not guaranteed to be quick to execute!
referencesTo in interface Tablepublic Enumeration referencesTo(Table table)
referencesTo in interface Tabletable -
public int getMostRecentTroid()
getMostRecentTroid in interface Tablepublic Integer troidFor(Persistent persistent)
troidFor in interface Tablepersistent - unused parameter, but might be needed in another troid schema
public void create(Persistent p)
throws AccessPoemException,
ValidationPoemException,
InitialisationPoemException
The given object will be assigned the next troid and its internal state will also be modified.
create in interface TableInitialisationPoemException - The object failed validation
AccessPoemException
ValidationPoemException
public Persistent create(Initialiser initialiser)
throws AccessPoemException,
ValidationPoemException,
InitialisationPoemException
create in interface Tableinitialiser - A piece of code for setting the new object's
initial values. You'll probably want to define
it as an anonymous class.
AccessPoemException - if initialiser provokes one during its work (which
is unlikely, since POEM's standard checks are disabled
while it runs)
ValidationPoemException - if initialiser provokes one during its work
InitialisationPoemException - if the object is left by initialiser in a state in
which not all of its fields have legal values, or in which
the calling thread would not be allowed write access to the
object under its AccessToken---i.e. you
can't create objects you wouldn't be allowed to write to.Initialiser.init(org.melati.poem.Persistent),
PoemThread.accessToken(),
getCanCreate()public Persistent newPersistent()
newPersistent in interface Tableprotected JdbcPersistent _newPersistent()
public void delete_unsafe(String whereClause)
delete_unsafe in interface TablewhereClause - the criteriapublic int extrasCount()
extrasCount in interface Tablepublic final Capability getDefaultCanRead()
getDefaultCanRead in interface Tablepublic final Capability getDefaultCanWrite()
getDefaultCanWrite in interface TableCapability required to write a
Persistent, if anypublic final Capability getDefaultCanDelete()
getDefaultCanDelete in interface TableCapability required to delete a
Persistent, if anypublic final Capability getCanCreate()
getCanCreate in interface Tablecreate(org.melati.poem.Initialiser)public final Column canReadColumn()
canReadColumn in interface Tablepublic final Column canSelectColumn()
canSelectColumn in interface Tablepublic final Column canWriteColumn()
canWriteColumn in interface Tablepublic final Column canDeleteColumn()
canDeleteColumn in interface Table
public Column addColumnAndCommit(ColumnInfo infoP)
throws PoemException
Column to the database and the TableInfo table.
addColumnAndCommit in interface TableinfoP - the meta data about the Column
PoemException
public void deleteColumnAndCommit(ColumnInfo columnInfo)
throws PoemException
deleteColumnAndCommit in interface TablecolumnInfo - metadata about the column to delete, which is itself deleted
PoemExceptionpublic String toString()
toString in interface TabletoString in class ObjectObject.toString()public void dumpCacheAnalysis()
dumpCacheAnalysis in interface Tablepublic void dump()
dump in interface Tablepublic void dump(PrintStream ps)
dump in interface Tableps - PrintStream to dump to
public CachedSelection cachedSelection(String whereClause,
String orderByClause)
cachedSelection in interface TablewhereClause - raw SQL selection clause appropriate for this DBMSorderByClause - which field to order by or null
public CachedCount cachedCount(String whereClause,
boolean includeDeleted)
cachedCount in interface TablewhereClause - raw SQL selection clause appropriate for this DBMSincludeDeleted - whether to include soft deleted records
public CachedCount cachedCount(String whereClause,
boolean includeDeleted,
boolean excludeUnselectable)
cachedCount in interface TablewhereClause - raw SQL selection clause appropriate for this DBMSincludeDeleted - whether to include soft deleted recordsexcludeUnselectable - whether to exclude columns which cannot be selected
public CachedCount cachedCount(Persistent criteria,
boolean includeDeleted,
boolean excludeUnselectable)
cachedCount in interface Tablecriteria - a Persistent with selection fields filledincludeDeleted - whether to include soft deleted recordsexcludeUnselectable - whether to exclude columns which cannot be selected
public CachedCount cachedCount(Persistent criteria)
cachedCount in interface Tablecriteria - a Persistent to extract where clause from
public CachedCount cachedCount(String whereClause)
cachedCount in interface TablewhereClause - raw SQL selection clause appropriate for this DBMS
public CachedExists cachedExists(String whereClause)
cachedExists in interface TablewhereClause - raw SQL selection clause appropriate for this DBMS
public RestrictedReferencePoemType cachedSelectionType(String whereClause,
String orderByClause,
boolean nullable)
cachedSelectionType in interface TablewhereClause - raw SQL selection clause appropriate for this DBMSorderByClause - raw SQL order clause appropriate for this DBMSnullable - whether the ReferencePoemType is nullable
RestrictedReferencePoemType
public Field cachedSelectionField(String whereClause,
String orderByClause,
boolean nullable,
Integer selectedTroid,
String nameP)
context.put("greens",
melati.getDatabase().getCustomerTable().cachedSelectionField(
"colour = 'green'", null, true, null, "greens"));
and this in your template
The list of member records is implicitly cached---permanently, and however big it turns out to be. So don't go mad with this. It is recomputed on demand if the contents of the table are changed. The whereClause and orderByClause you pass in are checked to see if you have asked for the same list before, so however many times you call this method, you should only trigger actual SELECTs when the table contents have changed. The list is also transaction-safe, in that it will always reflect the state of affairs within your transaction even if you haven't done a commit. It is the programmer's responsibility to ensure that the where clause is suitable for the target DBMS.Select a customer: $ml.input($greens)
cachedSelectionField in interface TablewhereClause - an SQL expression (the bit after the
SELECT ... WHERE) for picking
out the records you wantorderByClause - a comma-separated list of column names which
determine the order in which the records are
presented; if this is null, the
displayorderpriority attributes of the
table's columns determine the ordernullable - whether to allow a blank NULL option
as the first possibilityselectedTroid - the troid of the record to which the
SELECT field should initially be setnameP - the HTML name attribute of the field,
i.e.
<SELECT NAME=name>
public final void defineColumn(Column column)
throws DuplicateColumnNamePoemException,
DuplicateTroidColumnPoemException,
DuplicateDeletedColumnPoemException
defineColumn in interface TableDuplicateColumnNamePoemException
DuplicateTroidColumnPoemException
DuplicateDeletedColumnPoemExceptionpublic int getNextExtrasIndex()
getNextExtrasIndex in interface Tablepublic void setTableInfo(TableInfo tableInfo)
setTableInfo in interface TabletableInfo - the TableInfo to setpublic TableInfo getTableInfo()
getTableInfo in interface TableTableInfo for this table.protected String defaultDisplayName()
public String getDsdName()
defaultDisplayName()
above is overwritten.
getDsdName in interface Tableprotected int defaultDisplayOrder()
protected String defaultDescription()
protected Integer defaultCacheLimit()
protected boolean defaultRememberAllTroids()
protected String defaultCategory()
public void createTableInfo()
throws PoemException
createTableInfo in interface TablePoemException
public void unifyWithColumnInfo()
throws PoemException
unifyWithColumnInfo in interface TablePoemException
public void unifyWithDB(ResultSet colDescs)
throws PoemException
TableInfo
unifyWithDB in interface TablecolDescs - a JDBC ResultSet describing the columns
PoemExceptionpublic void init()
init in interface Tablepublic final int hashCode()
Persistent#hashCode() is defined in terms of this
but not used at the time of writing.
hashCode in class ObjectObject.hashCode()public boolean equals(Object t)
equals in class ObjectObject.equals(java.lang.Object)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||