|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.afcs.warts.db.DataSynchronization org.afcs.warts.db.DataSynchronizationScript
The DataSynchronizationScript class is used to generate
a preview of the SQL that will be executed by the
DataSynchronizationAction
class when two datasets are synchronized
based on the analysis performed by a DataComparison
instance.
Because of difficulties updating dates (precisely) and CLOB columns using scripts, running these scripts in a SQL tool will not guarantee proper data synchronization (it may work in simple cases).
LICENSE: This code is released to the public domain and may be used for any purpose whatsoever without permission or acknowledgment.
Field Summary | |
protected DataComparison |
_comparison
A reference to the comparison we're working with. |
protected TableDescription |
_destDescription
The description of the table we're going to be manipulating. |
protected java.lang.String |
_destQualTableName
The fully qualified name of the destination table (this is used in comments and debugging messages). |
protected java.lang.String |
_sourceQualTableName
The fully qualified name of the source table that data is being moved from (this is used in comments and debugging messages). |
Constructor Summary | |
DataSynchronizationScript(DataComparison comparison)
Initialises a new instance that will generate synchronization scripts based on the specified data comparison. |
Method Summary | |
protected int |
countRowsOfType(int[] rowIndices,
int type)
Returns the number of rows in the specified array of indices that are of the specified type in the current comparison. |
java.lang.String |
generateDeleteScript(int[] rowsToSync)
Returns a SQL delete script that will delete any rows found in dataset two that weren't in dataset one when the data comparison was performed and that have indices in the specified array. |
java.lang.String |
generateInsertScript(int[] rowsToSync)
Returns a SQL insert script that will insert any rows not found in dataset two that were found in dataset one when the data comparison was performed and that have indices in the specified array. |
java.lang.String |
generateUpdateScript(int[] rowsToSync)
Returns a SQL delete script that will update any rows found in both dataset one and two but with differing non-primary key column values when the data comparison was performed and that have indices in the specified array. |
java.lang.String |
toString()
Returns a textual representation of the current instance useful for debugging. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected final DataComparison _comparison
protected final TableDescription _destDescription
protected final java.lang.String _destQualTableName
protected final java.lang.String _sourceQualTableName
Constructor Detail |
public DataSynchronizationScript(DataComparison comparison)
comparison
- The comparison to generate scripts for.
java.lang.NullPointerException
- If comparison is null.Method Detail |
public java.lang.String generateDeleteScript(int[] rowsToSync)
rowsToSync
- The indices of the rows to synchronize. Only the row
indices that represent deleted rows will be handled.
java.lang.NullPointerException
- If rowsToSync is null.public java.lang.String generateInsertScript(int[] rowsToSync)
rowsToSync
- The indices of the rows to synchronize. Only the row
indices that represent inserted rows will be handled.
java.lang.NullPointerException
- If rowsToSync is null.public java.lang.String generateUpdateScript(int[] rowsToSync)
rowsToSync
- The indices of the rows to synchronize. Only the row
indices that represent updated rows will be handled.
java.lang.NullPointerException
- If rowsToSync is null.public java.lang.String toString()
protected int countRowsOfType(int[] rowIndices, int type)
rowIndices
- The array of row indices to scan.type
- The row type to count.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |