Package chemaxon.jchem.db
Class Updater
- java.lang.Object
-
- chemaxon.jchem.db.Updater
-
@PublicAPI public class Updater extends Object
Class for upgrading JChem database structure. Usage example:
String message = ""; ProgressWriter pw = ...; Updater ud = new Updater(conh); Updater.UpdateInfo ui = null; while ((ui = ud.getNextUpdateInfo()) != null) { if (displayMessage(ui)) { System.out.println("\n" + ui.processingMessage + "\n"); if (ui.isProgressMonitoringSupported) { message = ud.performCurrentUpdate(pw); } else { message = ud.performCurrentUpdate(); } System.out.println(message); } else if (ui.isOperationRequired) { // stopping, since further updates may depend on this one break; } }
- Since:
- JChem 3.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
Updater.UpdateInfo
Class describing the nature of an update.
-
Constructor Summary
Constructors Constructor Description Updater(ConnectionHandler conh)
Constructor.Updater(ConnectionHandler conh, List<String> tablesToConsider)
Similar toUpdater(ConnectionHandler)
, but adds the ability for the user to specify a list of tables to which to restrict the operation of thisUpdater
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Updater.UpdateInfo
getNextUpdateInfo()
Returns the update information for the next update step.Updater.UpdateInfo
getNextUpdateInfo(ProgressWriter pw)
Returns the update information for the next update step.boolean
isUpdateNeededForTable(String tableName)
Check whether structural upgrade is necessary for a particular table.static void
modifyExtColumnInOraclePropertyTable(ConnectionHandler connectionHandler)
String
performCurrentUpdate()
Performs the current update operation.String
performCurrentUpdate(ProgressWriter pw)
Performs the current update operation with progress monitoring where supported.
-
-
-
Constructor Detail
-
Updater
public Updater(ConnectionHandler conh)
Constructor.- Parameters:
conh
- ConnectionHandler with live connection- Since:
- JChem 3.2
-
Updater
public Updater(ConnectionHandler conh, List<String> tablesToConsider)
Similar toUpdater(ConnectionHandler)
, but adds the ability for the user to specify a list of tables to which to restrict the operation of thisUpdater
.- Parameters:
conh
- ConnectionHandler with live connectiontablesToConsider
- include only these tables in the update.- Since:
- JChem 3.2
-
-
Method Detail
-
getNextUpdateInfo
public Updater.UpdateInfo getNextUpdateInfo() throws SQLException
Returns the update information for the next update step.- Returns:
- the message, or
null
, if there are no more updates left - Throws:
SQLException
- if an error occurs- See Also:
performCurrentUpdate()
-
getNextUpdateInfo
public Updater.UpdateInfo getNextUpdateInfo(ProgressWriter pw) throws SQLException
Returns the update information for the next update step.- Parameters:
pw
- the progress writer- Returns:
- the message, or
null
, if there are no more updates left - Throws:
SQLException
- if an error occurs- Since:
- JChem 5.9
- See Also:
performCurrentUpdate()
-
isUpdateNeededForTable
public boolean isUpdateNeededForTable(String tableName) throws SQLException
Check whether structural upgrade is necessary for a particular table.- Parameters:
tableName
- Name of the structure table.- Returns:
- True, if upgrade is needed.
- Throws:
SQLException
- if an error occurs
-
performCurrentUpdate
public String performCurrentUpdate() throws SQLException
Performs the current update operation.- Returns:
- a status message
- Throws:
SQLException
- if an error occurs- See Also:
getNextUpdateInfo()
-
performCurrentUpdate
public String performCurrentUpdate(ProgressWriter pw) throws SQLException
Performs the current update operation with progress monitoring where supported.- Parameters:
pw
- the progress writer- Returns:
- a status message
- Throws:
SQLException
- if an error occurs- Since:
- JChem 5.1.2
- See Also:
getNextUpdateInfo()
-
modifyExtColumnInOraclePropertyTable
public static void modifyExtColumnInOraclePropertyTable(ConnectionHandler connectionHandler) throws SQLException
- Throws:
SQLException
-
-