Search in sources :

Example 6 with ImportDataFailedEvent

use of com.cubrid.common.ui.cubrid.table.dialog.imp.event.ImportDataFailedEvent in project cubrid-manager by CUBRID.

the class AbsImportRunnable method commit.

/**
	 *
	 * Commit the data
	 *
	 *
	 * @param monitor IProgressMonitor
	 * @param currentRow int
	 * @throws SQLException The exception
	 */
protected void commit(List<ImportRowData> rowList) throws SQLException {
    if (pStmt == null) {
        return;
    }
    try {
        pStmt.executeBatch();
        QueryUtil.commit(conn);
        handleEvent(new ImportDataSuccessEvent(tableName, rowList.size()));
        LOGGER.debug("Committed : " + rowList.size());
    } catch (SQLException ex) {
        QueryUtil.rollback(conn);
        ImportDataFailedEvent failedEvt = new ImportDataFailedEvent(tableName, rowList.size(), "", ex.getMessage());
        handleEvent(failedEvt);
        LOGGER.debug("Failed : " + rowList.size());
        writeErrorLog(rowList);
    } finally {
        rowList.clear();
        try {
            pStmt.clearBatch();
        } catch (SQLException e) {
            LOGGER.error(e.getMessage());
            processSQLException(e);
        }
    }
}
Also used : ImportDataSuccessEvent(com.cubrid.common.ui.cubrid.table.dialog.imp.event.ImportDataSuccessEvent) ImportDataFailedEvent(com.cubrid.common.ui.cubrid.table.dialog.imp.event.ImportDataFailedEvent) SQLException(java.sql.SQLException)

Aggregations

ImportDataFailedEvent (com.cubrid.common.ui.cubrid.table.dialog.imp.event.ImportDataFailedEvent)6 ImportRowData (com.cubrid.common.ui.cubrid.table.dialog.imp.model.ImportRowData)5 SQLException (java.sql.SQLException)5 ArrayList (java.util.ArrayList)5 ImportDataTableFailedEvent (com.cubrid.common.ui.cubrid.table.dialog.imp.event.ImportDataTableFailedEvent)4 File (java.io.File)4 IOException (java.io.IOException)3 ImportDataSuccessEvent (com.cubrid.common.ui.cubrid.table.dialog.imp.event.ImportDataSuccessEvent)2 FileInputStream (java.io.FileInputStream)2 FileReader (java.io.FileReader)2 InputStreamReader (java.io.InputStreamReader)2 CSVReader (com.cubrid.common.core.reader.CSVReader)1 TxtReader (com.cubrid.common.core.reader.TxtReader)1 XlsxReaderHandler (com.cubrid.common.ui.cubrid.table.control.XlsxReaderHandler)1 ImportFileDescription (com.cubrid.common.ui.cubrid.table.importhandler.ImportFileDescription)1 XLSImportFileHandler (com.cubrid.common.ui.cubrid.table.importhandler.handler.XLSImportFileHandler)1 XLSXImportFileHandler (com.cubrid.common.ui.cubrid.table.importhandler.handler.XLSXImportFileHandler)1 List (java.util.List)1 Cell (jxl.Cell)1 Sheet (jxl.Sheet)1