Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,29 @@ public UploadStatus findById(int uploadStatusId) throws UniqueKeyException {
return uploadStatus;
}

public void dropTempTable(String tempTable) {
public void dropTempTable(String tempTable){
final String sql = "{call " + getDbSchemaName()
+ "REMOVE_TEMP_TABLE(?)}";
jdbcTemplate.update(sql, new Object[] { tempTable });
Connection conn = null;
try {
conn = this.getDataSource().getConnection();
CallableStatement callStmt = conn.prepareCall(sql);
callStmt.setString(1, tempTable);
callStmt.execute();
} catch (SQLException sqlEx) {
sqlEx.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
} finally {
if (conn != null) {
try {
conn.close();
} catch (SQLException sqlEx) {
sqlEx.printStackTrace();
log.error("Error while closing connection", sqlEx);
}
}
}
}

/**
Expand Down Expand Up @@ -522,8 +541,7 @@ protected UploadStatusInsert(DataSource ds, String schemaName,
+ " log_file_name, " + " message, "
+ " transform_name) "
+ " VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)";
} else if (dataSourceLookup.getServerType().equalsIgnoreCase(
LoaderDAOFactoryHelper.ORACLE)) {
} else {
sql = "INSERT INTO " + schemaName + "upload_status ("
+ " upload_id," + " upload_label, " + " user_id, "
+ " source_cd, " + " no_of_record, "
Expand All @@ -535,9 +553,8 @@ protected UploadStatusInsert(DataSource ds, String schemaName,
}
this.setSql(sql);
this.setDataSource(dataSource);

if (dataSourceLookup.getServerType().equalsIgnoreCase(
LoaderDAOFactoryHelper.ORACLE)) {
if (!dataSourceLookup.getServerType().equalsIgnoreCase(
LoaderDAOFactoryHelper.SQLSERVER)){
declareParameter(new SqlParameter(Types.INTEGER));
}
declareParameter(new SqlParameter(Types.VARCHAR));
Expand Down Expand Up @@ -578,6 +595,24 @@ protected void insert(UploadStatus uploadStatus) {
uploadStatus.getTransformName() };
update(objs);

} else if (dataSourceLookup.getServerType().equalsIgnoreCase(
LoaderDAOFactoryHelper.POSTGRESQL)) {
uploadId = getJdbcTemplate().queryForInt("select nextval ('i2b2demodata.upload_status_upload_id_seq')");
uploadStatus.setUploadId(uploadId);
objs = new Object[] { uploadStatus.getUploadId(),
uploadStatus.getUploadLabel(),
uploadStatus.getUserId(), uploadStatus.getSourceCd(),
uploadStatus.getNoOfRecord(),
uploadStatus.getDeletedRecord(),
uploadStatus.getLoadedRecord(),
uploadStatus.getLoadDate(), uploadStatus.getEndDate(),
uploadStatus.getLoadStatus(),
uploadStatus.getInputFileName(),
uploadStatus.getLogFileName(),
uploadStatus.getMessage(),
uploadStatus.getTransformName() };
update(objs);

} else if (dataSourceLookup.getServerType().equalsIgnoreCase(
LoaderDAOFactoryHelper.SQLSERVER)) {
objs = new Object[] { uploadStatus.getUploadLabel(),
Expand Down