public abstract class DBView extends DBRowSet
Modifier and Type | Class and Description |
---|---|
static class |
DBView.DBViewColumn
DBViewColumn
|
DBRowSet.FieldInitMode, DBRowSet.PartialMode
beanType, columnReferences, columns, comment, db, entityName, log, timestampColumn
CTX_ALIAS, CTX_ALL, CTX_DEFAULT, CTX_FULLNAME, CTX_NAME, CTX_NOPARENTHESIS, CTX_VALUE
Constructor and Description |
---|
DBView(String name,
DBDatabase db)
Creates a view object for a given view in the database.
|
DBView(String name,
DBDatabase db,
boolean isUpdateable)
Creates a view object for a given view in the database.
|
Modifier and Type | Method and Description |
---|---|
protected DBView.DBViewColumn |
addColumn(DBTableColumn sourceColumn)
Adds a column to the view based on an existing column in another table or view.
|
protected void |
addColumn(DBView.DBViewColumn col)
Adds a column to the view.
|
protected DBView.DBViewColumn |
addColumn(String columnName,
DataType dataType)
Adds a column to the view.
|
protected DBView.DBViewColumn |
addColumn(String columnName,
DataType dataType,
double size)
Adds a column to the view.
|
protected DBView.DBViewColumn |
addColumn(String columnName,
DBColumnExpr columnExpr)
Adds a column to the view.
|
void |
addSQL(DBSQLBuilder sql,
long context)
Creates the SQL-Command adds the alias name to the SQL-Command.
|
abstract DBCommandExpr |
createCommand()
Returns the command required to create the view
This is function is only used for the creation of DDL statements |
void |
createRecord(DBRecordBase record,
Object[] initalKey,
boolean deferredInit) |
void |
deleteRecord(Object[] key,
DBContext context) |
DBView.DBViewColumn |
findViewColumn(DBColumnExpr expr)
This function searchs for equal columns given by the specified DBColumnExpr object.
|
String |
getAlias()
Returns the alias name of this object.
|
String |
getFullName()
Returns the full qualified table name.
|
DBColumn[] |
getKeyColumns()
Returns an array of all key columns.
|
String |
getName()
Returns the view name of this object.
|
boolean |
isUpdateable()
Returns whether or not the view is updateable
|
protected DBCommand |
newCommand()
Use this to create a new View command inside the createCommand() method!
|
protected void |
setKeyColumn(DBView.DBViewColumn keyColumn)
identifies the column that uniquely identifies a row in the view
|
protected void |
setKeyColumns(DBView.DBViewColumn... keyColumns)
identifies the columns that uniquely identify a row in the view
|
void |
updateRecord(DBRecordBase rec)
Updates or Inserts a record in the database.
|
addColumnReference, addReferencedColumns, checkParamRecord, completeInitRecord, count, createRecordCommand, deleteAllReferences, deleteRecord, deleteReferenceRecords, equals, getBeanType, getColumn, getColumn, getColumnExprAt, getColumnIndex, getColumnIndex, getColumnReferences, getColumns, getComment, getDatabase, getEntityName, getIdentifier, getKeyConstraints, getRenameTablePhrase, getRowsetData, getTimestampColumn, hashCode, initRecord, initRecord, initRecordDefaultValues, isColumnReadOnly, isKeyColumn, isSame, key, on, on, prepareInitRecord, readRecord, readRecord, readRecord, recordExists, recordExists, setBeanType, setBeanType, setComment, setEntityName, setRowsetData, setTimestampColumn
checkParamNull
public DBView(String name, DBDatabase db, boolean isUpdateable)
name
- the name of the viewdb
- the database this view belongs to.isUpdateable
- true if the records of this view can be updatedpublic DBView(String name, DBDatabase db)
name
- the name of the viewdb
- the database this view belongs to.public DBColumn[] getKeyColumns()
getKeyColumns
in interface EntityType
getKeyColumns
in class DBRowSet
protected void setKeyColumns(DBView.DBViewColumn... keyColumns)
keyColumns
- list of columns that uniquely identify a rowprotected void setKeyColumn(DBView.DBViewColumn keyColumn)
keyColumn
- the column that uniquely identifies a rowprotected DBCommand newCommand()
public abstract DBCommandExpr createCommand()
public String getName()
public String getFullName()
getFullName
in class DBRowSet
public String getAlias()
public boolean isUpdateable()
isUpdateable
in class DBRowSet
protected void addColumn(DBView.DBViewColumn col)
col
- a view column objectprotected final DBView.DBViewColumn addColumn(String columnName, DataType dataType, double size)
columnName
- name of the column in the viewdataType
- the data type of the columnsize
- the size of the columnprotected final DBView.DBViewColumn addColumn(String columnName, DataType dataType)
columnName
- name of the column in the viewdataType
- the data type of the columnprotected final DBView.DBViewColumn addColumn(String columnName, DBColumnExpr columnExpr)
columnName
- name of the column in the viewcolumnExpr
- the column expression that builds the columnprotected final DBView.DBViewColumn addColumn(DBTableColumn sourceColumn)
sourceColumn
- existing column in another table or viewpublic DBView.DBViewColumn findViewColumn(DBColumnExpr expr)
expr
- the DBColumnExpr objectpublic void addSQL(DBSQLBuilder sql, long context)
public void updateRecord(DBRecordBase rec)
DBRowSet
If a timestamp-column is set for this RowSet then a constraint will be added in the
update statement in order to detect concurrent changes.
If the record has been modified by another user, an error of type
DBErrors.RecordUpdateFailed will be set.
updateRecord
in class DBRowSet
rec
- the DBRecord object. contains all fields and the field propertiespublic void createRecord(DBRecordBase record, Object[] initalKey, boolean deferredInit)
createRecord
in class DBRowSet
public void deleteRecord(Object[] key, DBContext context)
deleteRecord
in class DBRowSet
Copyright © 2008–2023 Apache Software Foundation. All rights reserved.