|
|||||||||||
| 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 committedtransaction.. |
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 Rows I contain. |
protected RowIterator |
getRowIterator()
|
protected String |
getSelectSQL(String where,
List orderByColumns)
|
Properties |
getTableProperties()
Gets Organization Property. |
TransactableTable |
makeTransactableTable()
Create a TransactableTablefor 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 TableaddConstraint in class BaseTableAxionExceptionpublic void removeConstraint(String name)
removeConstraint in interface TableremoveConstraint in class BaseTable
public void applyDeletes(org.apache.commons.collections.primitives.IntCollection rowIds)
throws AxionException
Table
applyDeletes in interface TableapplyDeletes in class BaseTableAxionException
public void applyInserts(Collection rows)
throws AxionException
Table
applyInserts in interface TableapplyInserts in class BaseTableAxionException
public void applyUpdates(Collection rows)
throws AxionException
Table
applyUpdates in interface TableapplyUpdates in class BaseTableAxionException
public void remount()
throws AxionException
remount in interface ExternalTableAxionException
public void drop()
throws AxionException
Table
drop in interface Tabledrop in class BaseTableAxionExceptionpublic void freeRowId(int id)
Table
freeRowId in interface TablefreeRowId in class BaseTablepublic int getNextRowId()
Table
getNextRowId in interface TablegetNextRowId in class BaseTable
public Row getRow(int id)
throws AxionException
getRow in interface RowSourcegetRow in class BaseTableAxionExceptionpublic int getRowCount()
TableRows I contain.
getRowCount in interface TablegetRowCount in class BaseTable
public void populateIndex(Index index)
throws AxionException
TableIndex, adding my current rows to it. Does not
addthe index.
populateIndex in interface TablepopulateIndex in class BaseTableAxionException
public boolean setTableProperties(Properties props)
throws AxionException
ExternalTable
setTableProperties in interface ExternalTableprops - configuration properties for this external table
AxionExceptionpublic Properties getTableProperties()
ExternalTable
getTableProperties in interface ExternalTable
public void shutdown()
throws AxionException
Table
shutdown in interface Tableshutdown in class BaseTableAxionException
public void truncate()
throws AxionException
Table
truncate in interface TableAxionException
public void apply()
throws AxionException
Transactablecommittedtransaction..
apply in interface TransactableAxionException
public void commit()
throws AxionException
Transactable
commit in interface TransactableAxionException
public void rollback()
throws AxionException
Transactable
rollback in interface TransactableAxionExceptionpublic TransactableTable makeTransactableTable()
TableTransactableTablefor this table.
makeTransactableTable in interface TablemakeTransactableTable 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 BaseTableAxionException
protected void createOrLoadResultSet(boolean unconditionally)
throws AxionException
AxionException
protected void createRemoteTableIfNotExists()
throws AxionException
AxionException
protected void createResultSet()
throws AxionException
AxionExceptionprotected String getCreateSQL()
protected Row getRowByOffset(int rowId)
throws AxionException
AxionException
protected RowIterator getRowIterator()
throws AxionException
getRowIterator in class BaseTableAxionException
protected String getSelectSQL(String where,
List orderByColumns)
protected void setUp(DatabaseLink server)
throws AxionException
AxionException
protected boolean tableExistsInRemoteDB()
throws AxionException
AxionExceptionprotected String getInsertSQL()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||