|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 Table
notifyColumnInfo(ColumnInfo)
,
clearColumnInfoCaches()
public final Database getDatabase()
getDatabase
in interface Table
public final String getName()
getName
in interface Table
Dbms.melatiName(String)
public final String quotedName()
quotedName
in interface Table
public final String getDisplayName()
getDisplayName
in interface Table
public final String getDescription()
getDescription
in interface Table
public final TableCategory getCategory()
getCategory
in interface Table
public final TableInfo getInfo()
getInfo
in interface Table
TableInfo
for this tablepublic final Integer tableInfoID()
tableInfoID
in interface Table
public final Column getColumn(String nameP) throws NoSuchColumnPoemException
getColumn
in interface Table
nameP
- 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 Table
Column
public final int getColumnsCount()
getColumnsCount
in interface Table
public Column columnWithColumnInfoID(int columnInfoID)
columnWithColumnInfoID
in interface Table
columnInfoID
-
public final Column troidColumn()
troidColumn
in interface Table
getObject(java.lang.Integer)
public final Column deletedColumn()
deletedColumn
in interface Table
public final Column displayColumn()
displayColumn
in interface Table
ReferencePoemType._stringOfCooked(java.lang.Object, org.melati.poem.PoemLocale, int)
,
DisplayLevel.primary
public final void setDisplayColumn(Column column)
setDisplayColumn
in interface Table
column
- 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 Table
Searchability
public void setSearchColumn(Column column)
setSearchColumn
in interface Table
column
- the search column to setpublic String defaultOrderByClause()
defaultOrderByClause
in interface Table
public void clearColumnInfoCaches()
clearColumnInfoCaches
in interface Table
public void notifyColumnInfo(ColumnInfo infoP)
notifyColumnInfo
in interface Table
infoP
- the possibly null ColumnInfo meta-data persistentpublic final Enumeration displayColumns(DisplayLevel level)
displayColumns
in interface Table
level
- the DisplayLevel
to select
public final int displayColumnsCount(DisplayLevel level)
displayColumnsCount
in interface Table
level
- the DisplayLevel
to select
public final Enumeration getDetailDisplayColumns()
getDetailDisplayColumns
in interface Table
Column
,
displayColumns(DisplayLevel)
,
DisplayLevel.detail
public final int getDetailDisplayColumnsCount()
getDetailDisplayColumnsCount
in interface Table
public final Enumeration getRecordDisplayColumns()
getRecordDisplayColumns
in interface Table
Column
,
displayColumns(DisplayLevel)
,
DisplayLevel.record
public final int getRecordDisplayColumnsCount()
getRecordDisplayColumnsCount
in interface Table
public final Enumeration getSummaryDisplayColumns()
getSummaryDisplayColumns
in interface Table
Column
,
displayColumns(DisplayLevel)
,
DisplayLevel.summary
public final int getSummaryDisplayColumnsCount()
getSummaryDisplayColumnsCount
in interface Table
public final Enumeration getSearchCriterionColumns()
getSearchCriterionColumns
in interface Table
Column
public final int getSearchCriterionColumnsCount()
getSearchCriterionColumnsCount
in interface Table
public void dbModifyStructure(String sql) throws StructuralModificationFailedPoemException
dbModifyStructure
in interface Table
sql
- the SQL DDL statement to execute
StructuralModificationFailedPoemException
public String getDbmsTableType()
getDbmsTableType
in interface Table
org.melati.poem.dbms.Hsqldb}
public void dbAddConstraints()
dbAddConstraints
in interface Table
public void invalidateTransactionStuffs()
invalidateTransactionStuffs
in interface Table
public void load(PoemTransaction transaction, Persistent persistent)
load
in interface Table
transaction
- possibly null if working with the committed transactionpersistent
- the Persistent to loadpublic void delete(Integer troid, PoemTransaction transaction)
delete
in interface Table
troid
- id of row to deletetransaction
- a non-null transactionpublic void writeDown(PoemTransaction transaction, Persistent p)
writeDown
in interface Table
transaction
- our PoemTransactionp
- the Persistent to writepublic void uncache()
uncache
in interface Table
public void trimCache(int maxSize)
trimCache
in interface Table
maxSize
- new maximum sizepublic Cache.Info getCacheInfo()
getCacheInfo
in interface Table
public void addListener(TableListener listener)
TableListener
to this Table.
addListener
in interface Table
public void notifyTouched(PoemTransaction transaction, Persistent persistent)
notifyTouched
in interface Table
transaction
- the transaction in which the change will be madepersistent
- the record to be changedpublic long serial(PoemTransaction transaction)
serial
in interface Table
public void readLock()
readLock
in interface Table
public Persistent getObject(Integer troid) throws NoSuchRowPoemException
getObject
in interface Selectable
getObject
in interface Table
troid
- 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 Table
troid
- 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 Table
fromClause
- 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 Table
Enumeration
of Troids satisfying the criteria.public Enumeration troidSelection(Persistent criteria, String orderByClause, boolean includeDeleted, boolean excludeUnselectable, PoemTransaction transaction)
troidSelection
in interface Table
criteria
- 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 Table
flag
- whether to remember or forgetpublic void setCacheLimit(Integer limit)
setCacheLimit
in interface Table
limit
- the limit to setpublic Enumeration<Integer> troidSelection(String whereClause, String orderByClause, boolean includeDeleted) throws SQLPoemException
troidSelection
in interface Table
whereClause
- an SQL snippetorderByClause
- an SQL snippetincludeDeleted
- whether to include deleted records, if any
SQLPoemException
getObject(java.lang.Integer)
,
selection(java.lang.String, java.lang.String, boolean)
public Enumeration<Persistent> selection() throws SQLPoemException
selection
in interface Selectable
selection
in interface Table
SQLPoemException
Selectable.selection()
public final Enumeration selection(String whereClause) throws SQLPoemException
selection
in interface Table
whereClause
- SQL SELECTion criteria for the search:
the part that should appear after the
WHERE keyword
SQLPoemException
Column.selectionWhereEq(java.lang.Object)
public Persistent firstSelection(String whereClause)
firstSelection
in interface Table
whereClause
- 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 Table
includeDeleted
- whether to return objects flagged as deleted
(ignored if the table doesn't have a
deleted column)
SQLPoemException
selection(java.lang.String)
public Enumeration selection(Persistent criteria) throws SQLPoemException
selection
in interface Table
criteria
- Represents selection criteria possibly on joined tables
SQLPoemException
selection(String, String, boolean)
public Enumeration selection(Persistent criteria, String orderByClause) throws SQLPoemException
selection
in interface Table
criteria
- Represents selection criteria possibly on joined tablesorderByClause
- Comma separated list
SQLPoemException
selection(String, String, boolean)
public Enumeration selection(Persistent criteria, String orderByClause, boolean includeDeleted, boolean excludeUnselectable) throws SQLPoemException
selection
in interface Table
criteria
- Represents selection criteria possibly on joined tablesorderByClause
- Comma separated listexcludeUnselectable
- Whether to append unselectable exclusion SQL
SQLPoemException
selection(String, String, boolean)
public String countSQL(String whereClause)
countSQL
in interface Table
whereClause
-
public String countSQL(String fromClause, String whereClause, boolean includeDeleted, boolean excludeUnselectable)
countSQL
in interface Table
fromClause
- Comma separated list of table names
public int count(String whereClause, boolean includeDeleted, boolean excludeUnselectable) throws SQLPoemException
count
in interface Table
SQLPoemException
public int count(String whereClause, boolean includeDeleted) throws SQLPoemException
count
in interface Table
SQLPoemException
public int count(String whereClause) throws SQLPoemException
count
in interface Table
SQLPoemException
public int count() throws SQLPoemException
count
in interface Table
SQLPoemException
public boolean exists(String whereClause) throws SQLPoemException
exists
in interface Table
whereClause
- the SQL criteria
SQLPoemException
public boolean exists(Persistent persistent)
exists
in interface Table
persistent
- 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 Table
notifyColumnInfo(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 Table
public String cnfWhereClause(Enumeration persistents)
cnfWhereClause
in interface Table
cnfWhereClause(Enumeration, boolean, boolean)
,
whereClause(Persistent)
public String cnfWhereClause(Enumeration persistents, boolean includeDeleted, boolean excludeUnselectable)
cnfWhereClause
in interface Table
public Enumeration referencesTo(Persistent object)
It is not guaranteed to be quick to execute!
referencesTo
in interface Table
public Enumeration referencesTo(Table table)
referencesTo
in interface Table
table
-
public int getMostRecentTroid()
getMostRecentTroid
in interface Table
public Integer troidFor(Persistent persistent)
troidFor
in interface Table
persistent
- 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 Table
InitialisationPoemException
- The object failed validation
AccessPoemException
ValidationPoemException
public Persistent create(Initialiser initialiser) throws AccessPoemException, ValidationPoemException, InitialisationPoemException
create
in interface Table
initialiser
- 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 Table
protected JdbcPersistent _newPersistent()
public void delete_unsafe(String whereClause)
delete_unsafe
in interface Table
whereClause
- the criteriapublic int extrasCount()
extrasCount
in interface Table
public final Capability getDefaultCanRead()
getDefaultCanRead
in interface Table
public final Capability getDefaultCanWrite()
getDefaultCanWrite
in interface Table
Capability
required to write a
Persistent
, if anypublic final Capability getDefaultCanDelete()
getDefaultCanDelete
in interface Table
Capability
required to delete a
Persistent
, if anypublic final Capability getCanCreate()
getCanCreate
in interface Table
create(org.melati.poem.Initialiser)
public final Column canReadColumn()
canReadColumn
in interface Table
public final Column canSelectColumn()
canSelectColumn
in interface Table
public final Column canWriteColumn()
canWriteColumn
in interface Table
public 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 Table
infoP
- the meta data about the Column
PoemException
public void deleteColumnAndCommit(ColumnInfo columnInfo) throws PoemException
deleteColumnAndCommit
in interface Table
columnInfo
- metadata about the column to delete, which is itself deleted
PoemException
public String toString()
toString
in interface Table
toString
in class Object
Object.toString()
public void dumpCacheAnalysis()
dumpCacheAnalysis
in interface Table
public void dump()
dump
in interface Table
public void dump(PrintStream ps)
dump
in interface Table
ps
- PrintStream to dump topublic CachedSelection cachedSelection(String whereClause, String orderByClause)
cachedSelection
in interface Table
whereClause
- 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 Table
whereClause
- 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 Table
whereClause
- 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 Table
criteria
- 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 Table
criteria
- a Persistent to extract where clause from
public CachedCount cachedCount(String whereClause)
cachedCount
in interface Table
whereClause
- raw SQL selection clause appropriate for this DBMS
public CachedExists cachedExists(String whereClause)
cachedExists
in interface Table
whereClause
- raw SQL selection clause appropriate for this DBMS
public RestrictedReferencePoemType cachedSelectionType(String whereClause, String orderByClause, boolean nullable)
cachedSelectionType
in interface Table
whereClause
- 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)
and this in your templatecontext.put("greens", melati.getDatabase().getCustomerTable().cachedSelectionField( "colour = 'green'", null, true, null, "greens"));
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 Table
whereClause
- 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 Table
DuplicateColumnNamePoemException
DuplicateTroidColumnPoemException
DuplicateDeletedColumnPoemException
public int getNextExtrasIndex()
getNextExtrasIndex
in interface Table
public void setTableInfo(TableInfo tableInfo)
setTableInfo
in interface Table
tableInfo
- the TableInfo to setpublic TableInfo getTableInfo()
getTableInfo
in interface Table
TableInfo
for this table.protected String defaultDisplayName()
public String getDsdName()
defaultDisplayName()
above is overwritten.
getDsdName
in interface Table
protected int defaultDisplayOrder()
protected String defaultDescription()
protected Integer defaultCacheLimit()
protected boolean defaultRememberAllTroids()
protected String defaultCategory()
public void createTableInfo() throws PoemException
createTableInfo
in interface Table
PoemException
public void unifyWithColumnInfo() throws PoemException
unifyWithColumnInfo
in interface Table
PoemException
public void unifyWithDB(ResultSet colDescs) throws PoemException
TableInfo
unifyWithDB
in interface Table
colDescs
- a JDBC ResultSet
describing the columns
PoemException
public void init()
init
in interface Table
public final int hashCode()
Persistent#hashCode()
is defined in terms of this
but not used at the time of writing.
hashCode
in class Object
Object.hashCode()
public boolean equals(Object t)
equals
in class Object
Object.equals(java.lang.Object)
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |