mirror of
https://github.com/apache/sqoop.git
synced 2025-05-06 23:31:51 +08:00
SQOOP-1734: Port SQOOP-1725 to sqoop2 branch
(Abraham Elmahrek via Jarek Jarcec Cecho)
This commit is contained in:
parent
37a5552bab
commit
dacf889c7d
@ -175,11 +175,14 @@ public void upgradeConnectorAndConfigs(MConnector mConnector, Connection conn) {
|
|||||||
private void updateConnectorAndDeleteConfigs(MConnector mConnector, Connection conn) {
|
private void updateConnectorAndDeleteConfigs(MConnector mConnector, Connection conn) {
|
||||||
PreparedStatement updateConnectorStatement = null;
|
PreparedStatement updateConnectorStatement = null;
|
||||||
PreparedStatement deleteConfig = null;
|
PreparedStatement deleteConfig = null;
|
||||||
|
PreparedStatement deleteConfigDirection = null;
|
||||||
PreparedStatement deleteInput = null;
|
PreparedStatement deleteInput = null;
|
||||||
try {
|
try {
|
||||||
updateConnectorStatement = conn.prepareStatement(CommonRepositoryInsertUpdateDeleteSelectQuery.STMT_UPDATE_CONFIGURABLE);
|
updateConnectorStatement = conn.prepareStatement(CommonRepositoryInsertUpdateDeleteSelectQuery.STMT_UPDATE_CONFIGURABLE);
|
||||||
deleteInput = conn.prepareStatement(CommonRepositoryInsertUpdateDeleteSelectQuery.STMT_DELETE_INPUTS_FOR_CONFIGURABLE);
|
deleteInput = conn.prepareStatement(CommonRepositoryInsertUpdateDeleteSelectQuery.STMT_DELETE_INPUTS_FOR_CONFIGURABLE);
|
||||||
|
deleteConfigDirection = conn.prepareStatement(CommonRepositoryInsertUpdateDeleteSelectQuery.STMT_DELETE_DIRECTIONS_FOR_CONFIGURABLE);
|
||||||
deleteConfig = conn.prepareStatement(CommonRepositoryInsertUpdateDeleteSelectQuery.STMT_DELETE_CONFIGS_FOR_CONFIGURABLE);
|
deleteConfig = conn.prepareStatement(CommonRepositoryInsertUpdateDeleteSelectQuery.STMT_DELETE_CONFIGS_FOR_CONFIGURABLE);
|
||||||
|
|
||||||
updateConnectorStatement.setString(1, mConnector.getUniqueName());
|
updateConnectorStatement.setString(1, mConnector.getUniqueName());
|
||||||
updateConnectorStatement.setString(2, mConnector.getClassName());
|
updateConnectorStatement.setString(2, mConnector.getClassName());
|
||||||
updateConnectorStatement.setString(3, mConnector.getVersion());
|
updateConnectorStatement.setString(3, mConnector.getVersion());
|
||||||
@ -190,15 +193,17 @@ private void updateConnectorAndDeleteConfigs(MConnector mConnector, Connection c
|
|||||||
throw new SqoopException(CommonRepositoryError.COMMON_0035);
|
throw new SqoopException(CommonRepositoryError.COMMON_0035);
|
||||||
}
|
}
|
||||||
deleteInput.setLong(1, mConnector.getPersistenceId());
|
deleteInput.setLong(1, mConnector.getPersistenceId());
|
||||||
|
deleteConfigDirection.setLong(1, mConnector.getPersistenceId());
|
||||||
deleteConfig.setLong(1, mConnector.getPersistenceId());
|
deleteConfig.setLong(1, mConnector.getPersistenceId());
|
||||||
deleteInput.executeUpdate();
|
deleteInput.executeUpdate();
|
||||||
|
deleteConfigDirection.executeUpdate();
|
||||||
deleteConfig.executeUpdate();
|
deleteConfig.executeUpdate();
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
logException(e, mConnector);
|
logException(e, mConnector);
|
||||||
throw new SqoopException(CommonRepositoryError.COMMON_0035, e);
|
throw new SqoopException(CommonRepositoryError.COMMON_0035, e);
|
||||||
} finally {
|
} finally {
|
||||||
closeStatements(updateConnectorStatement, deleteConfig, deleteInput);
|
closeStatements(updateConnectorStatement, deleteConfig, deleteConfigDirection, deleteInput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,4 +549,11 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
|
|||||||
public static final String STMT_SELECT_SQ_CONFIG_DIRECTIONS =
|
public static final String STMT_SELECT_SQ_CONFIG_DIRECTIONS =
|
||||||
STMT_SELECT_SQ_CONFIG_DIRECTIONS_ALL + " WHERE "
|
STMT_SELECT_SQ_CONFIG_DIRECTIONS_ALL + " WHERE "
|
||||||
+ COLUMN_SQ_CFG_DIR_CONFIG + " = ?";
|
+ COLUMN_SQ_CFG_DIR_CONFIG + " = ?";
|
||||||
|
|
||||||
|
// Delete the config directions for a connector
|
||||||
|
public static final String STMT_DELETE_DIRECTIONS_FOR_CONFIGURABLE =
|
||||||
|
"DELETE FROM " + TABLE_SQ_CONFIG_DIRECTIONS
|
||||||
|
+ " WHERE " + COLUMN_SQ_CFG_DIR_CONFIG
|
||||||
|
+ " IN (SELECT " + COLUMN_SQ_CFG_ID + " FROM " + TABLE_SQ_CONFIG
|
||||||
|
+ " WHERE " + COLUMN_SQ_CFG_CONFIGURABLE + " = ?)";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user