|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.axiondb.event.BaseTableModificationPublisher
org.axiondb.engine.tables.BaseTable
org.axiondb.engine.tables.ExternalDatabaseTable
Base implementation of ExternalTable interface.
Example:
create external table emp (lname varchar(80), sid integer(6),
fname varchar(80), id integer(6) not null, dob timestamp(6))
organization (loadtype='remote' SERVER='myserver' REMOTETABLE='mytablename' SCHEMA='myschema'
ORDERBY='id' WHERE='id > 1000');
Note : We have tested this for Oracle 8i/9i , SQL Server, Sybase.
If you use WHERE, ORDER BY it is almost similar to creating a remote view, and you will
not be able to update it. We use Scrollable ResultSet to perform Insert/Update/Delete
operations, which may have some perfermance concern depending on the data size.
TODO: Use prepare statement for update and insert
TODO: Use Vendor specific code for truncate, table exists check, escape id
TODO: Support remote table drop, create/drop index, create/drop constraint
DROP DATABASE LINK should de-link the table and drop table should drop table on remote as well as local
DatabaseLink
Field Summary | |
static String |
PROP_CATALOG
Property key name for catalog name |
static String |
PROP_DB
Property key name for database link |
static String |
PROP_ORDERBY
Property key name for where filter |
static String |
PROP_REMOTETABLE
Property key name for remote table name |
static String |
PROP_SCHEMA
Property key name for schema name |
static String |
PROP_WHERE
Property key name for where filter |
Fields inherited from interface org.axiondb.ExternalTable |
DELIMITED_TABLE_TYPE, EXTERNAL_DB_TABLE_TYPE, FW_TABLE_TYPE, PROP_LOADTYPE, TAGGED_EBCDIC_TABLE_TYPE |
Fields inherited from interface org.axiondb.Table |
REGULAR_TABLE_TYPE, SYSTEM_TABLE_TYPE |
Constructor Summary | |
ExternalDatabaseTable(String name,
Database db)
|
Method Summary | |
void |
addConstraint(Constraint constraint)
|
void |
apply()
Apply this committed transaction.. |
void |
applyDeletes(org.apache.commons.collections.primitives.IntCollection rowIds)
Remove the specified rows from this table and any associated indices. |
void |
applyInserts(Collection rows)
Insert the given rows into this table and any associated indices. |
void |
applyUpdates(Collection rows)
Update the given rows in this table and any associated indices. |
protected void |
assertConnection()
|
protected void |
assertExternalResultSet()
|
protected void |
assertUpdatable()
|
protected void |
checkConstraints(RowEvent event)
|
void |
commit()
This transaction has been committed. |
protected void |
createOrLoadResultSet(boolean unconditionally)
|
protected void |
createRemoteTableIfNotExists()
|
protected void |
createResultSet()
|
void |
drop()
Drop this table from the database. |
void |
freeRowId(int id)
Un-reserve a row id. |
protected String |
getCreateSQL()
|
protected String |
getInsertSQL()
|
int |
getNextRowId()
Reserve a row id. |
Row |
getRow(int id)
|
protected Row |
getRowByOffset(int rowId)
|
int |
getRowCount()
Return the number of Row s I contain. |
protected RowIterator |
getRowIterator()
|
protected String |
getSelectSQL(String where,
List orderByColumns)
|
Properties |
getTableProperties()
Gets Organization Property. |
TransactableTable |
makeTransactableTable()
Create a TransactableTable for this table. |
void |
populateIndex(Index index)
Populate an Index , adding my current rows to it. |
void |
remount()
|
void |
removeConstraint(String name)
|
void |
rollback()
This transaction has been aborted. |
boolean |
setTableProperties(Properties props)
Sets collection of configuration properties for this external table to the given Properties instance. |
protected void |
setUp(DatabaseLink server)
|
void |
shutdown()
The database is shutting down, shutdown this table also. |
protected boolean |
tableExistsInRemoteDB()
|
void |
truncate()
Unconditionally delete all rows in this table. |
Methods inherited from class org.axiondb.event.BaseTableModificationPublisher |
addTableModificationListener, getTableModificationListeners, publishEvent, removeTableModificationListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.axiondb.Table |
addColumn, addIndex, addRow, addTableModificationListener, getColumn, getColumn, getColumnCount, getColumnIdentifiers, getColumnIndex, getConstraints, getIndexedRows, getIndexForColumn, getIndices, getMatchingRows, getName, getRowIterator, getType, hasColumn, hasIndex, isColumnIndexed, isPrimaryKeyConstraintExists, isUniqueConstraintExists, makeRowDecorator, remount, removeIndex, removeTableModificationListener, rename, updateRow |
Field Detail |
public static final String PROP_CATALOG
public static final String PROP_DB
public static final String PROP_ORDERBY
public static final String PROP_REMOTETABLE
public static final String PROP_SCHEMA
public static final String PROP_WHERE
Constructor Detail |
public ExternalDatabaseTable(String name, Database db)
Method Detail |
public void addConstraint(Constraint constraint) throws AxionException
addConstraint
in interface Table
addConstraint
in class BaseTable
AxionException
public void removeConstraint(String name)
removeConstraint
in interface Table
removeConstraint
in class BaseTable
public void applyDeletes(org.apache.commons.collections.primitives.IntCollection rowIds) throws AxionException
Table
applyDeletes
in interface Table
applyDeletes
in class BaseTable
AxionException
public void applyInserts(Collection rows) throws AxionException
Table
applyInserts
in interface Table
applyInserts
in class BaseTable
AxionException
public void applyUpdates(Collection rows) throws AxionException
Table
applyUpdates
in interface Table
applyUpdates
in class BaseTable
AxionException
public void remount() throws AxionException
remount
in interface ExternalTable
AxionException
public void drop() throws AxionException
Table
drop
in interface Table
drop
in class BaseTable
AxionException
public void freeRowId(int id)
Table
freeRowId
in interface Table
freeRowId
in class BaseTable
public int getNextRowId()
Table
getNextRowId
in interface Table
getNextRowId
in class BaseTable
public Row getRow(int id) throws AxionException
getRow
in interface RowSource
getRow
in class BaseTable
AxionException
public int getRowCount()
Table
Row
s I contain.
getRowCount
in interface Table
getRowCount
in class BaseTable
public void populateIndex(Index index) throws AxionException
Table
Index
, adding my current rows to it. Does not
add
the index.
populateIndex
in interface Table
populateIndex
in class BaseTable
AxionException
public boolean setTableProperties(Properties props) throws AxionException
ExternalTable
setTableProperties
in interface ExternalTable
props
- configuration properties for this external table
AxionException
public Properties getTableProperties()
ExternalTable
getTableProperties
in interface ExternalTable
public void shutdown() throws AxionException
Table
shutdown
in interface Table
shutdown
in class BaseTable
AxionException
public void truncate() throws AxionException
Table
truncate
in interface Table
AxionException
public void apply() throws AxionException
Transactable
committed
transaction..
apply
in interface Transactable
AxionException
public void commit() throws AxionException
Transactable
commit
in interface Transactable
AxionException
public void rollback() throws AxionException
Transactable
rollback
in interface Transactable
AxionException
public TransactableTable makeTransactableTable()
Table
TransactableTable
for this table.
makeTransactableTable
in interface Table
makeTransactableTable
in class BaseTable
protected void assertConnection() throws AxionException
AxionException
protected void assertExternalResultSet() throws AxionException
AxionException
protected void assertUpdatable() throws AxionException
AxionException
protected void checkConstraints(RowEvent event) throws AxionException
checkConstraints
in class BaseTable
AxionException
protected void createOrLoadResultSet(boolean unconditionally) throws AxionException
AxionException
protected void createRemoteTableIfNotExists() throws AxionException
AxionException
protected void createResultSet() throws AxionException
AxionException
protected String getCreateSQL()
protected Row getRowByOffset(int rowId) throws AxionException
AxionException
protected RowIterator getRowIterator() throws AxionException
getRowIterator
in class BaseTable
AxionException
protected String getSelectSQL(String where, List orderByColumns)
protected void setUp(DatabaseLink server) throws AxionException
AxionException
protected boolean tableExistsInRemoteDB() throws AxionException
AxionException
protected String getInsertSQL()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |