void transferData(int iMaxRows) throws Exception, SQLException { if (destDb.helper.needTransferTransaction()) { try { destDb.setAutoCommit(false); } catch (Exception e) { } } try { if (Stmts.bInsert) { if (destDb.helper.needTransferTransaction()) { try { destDb.setAutoCommit(false); } catch (Exception e) { } } tracer.trace("Executing " + Stmts.sSourceSelect); TransferResultSet r = sourceDb.getData(Stmts.sSourceSelect); tracer.trace("Start transfering data..."); destDb.beginDataTransfer(); tracer.trace("Executing " + Stmts.sDestInsert); destDb.putData(Stmts.sDestInsert, r, iMaxRows); destDb.endDataTransfer(); tracer.trace("Finished"); if (!destDb.getAutoCommit()) { destDb.commit(); try { destDb.setAutoCommit(true); } catch (Exception e) { } } } } catch (Exception e) { try { if (!destDb.getAutoCommit()) { destDb.rollback(); } } catch (Exception e1) { } throw (e); } if (!destDb.getAutoCommit()) { destDb.commit(); try { destDb.setAutoCommit(true); } catch (Exception e) { } } }
/** * Prints a disassembled view of the given attribute. * * @param attr an attribute. */ public void visitAttribute(final Attribute attr) { buf.setLength(0); buf.append(tab).append("ATTRIBUTE "); appendDescriptor(-1, attr.type); if (attr instanceof Traceable) { ((Traceable) attr).trace(buf, null); } else { buf.append(" : unknown\n"); } text.add(buf.toString()); }
/** * Method declaration * * @param t * @throws SQLException */ void transferAlter() throws Exception { String Statement = new String(""); if (destDb.helper.needTransferTransaction()) { try { destDb.setAutoCommit(false); } catch (Exception e) { } } if (Stmts.bTransfer == false) { tracer.trace("Table " + Stmts.sSourceTable + " not transfered"); return; } tracer.trace("Table " + Stmts.sSourceTable + ": start alter"); try { if (Stmts.bCreateIndex) { if (Stmts.sDestCreateIndex.charAt(Stmts.sDestCreateIndex.length() - 1) != ';') { Stmts.sDestCreateIndex += ";"; } int lastsemicolon = 0; int nextsemicolon = Stmts.sDestCreateIndex.indexOf(';'); while (nextsemicolon > lastsemicolon) { Statement = Stmts.sDestCreateIndex.substring(lastsemicolon, nextsemicolon); while (Statement.charAt(Statement.length() - 1) == ';') { Statement = Statement.substring(0, Statement.length() - 1); } try { tracer.trace("Executing " + Stmts.sDestCreateIndex); destDb.execute(Statement); } catch (Exception e) { tracer.trace("Ignoring error " + e.getMessage()); } lastsemicolon = nextsemicolon + 1; nextsemicolon = lastsemicolon + Stmts.sDestCreateIndex.substring(lastsemicolon).indexOf(';'); } } if (Stmts.bAlter) { if (Stmts.sDestAlter.charAt(Stmts.sDestAlter.length() - 1) != ';') { Stmts.sDestAlter += ";"; } int lastsemicolon = 0; int nextsemicolon = Stmts.sDestAlter.indexOf(';'); while (nextsemicolon > lastsemicolon) { Statement = Stmts.sDestAlter.substring(lastsemicolon, nextsemicolon); while (Statement.charAt(Statement.length() - 1) == ';') { Statement = Statement.substring(0, Statement.length() - 1); } try { tracer.trace("Executing " + Statement); destDb.execute(Statement); } catch (Exception e) { tracer.trace("Ignoring error " + e.getMessage()); } lastsemicolon = nextsemicolon + 1; nextsemicolon = lastsemicolon + Stmts.sDestAlter.substring(lastsemicolon).indexOf(';'); } } } catch (Exception e) { try { if (!destDb.getAutoCommit()) { destDb.rollback(); } } catch (Exception e1) { } throw (e); } if (!destDb.getAutoCommit()) { destDb.commit(); try { destDb.setAutoCommit(true); } catch (Exception e) { } } }