@SuppressWarnings("unchecked") public <T> T getObject(int columnIndex, Class<T> type) throws SQLException { if (type == null) { throw SQLError.createSQLException("Type parameter can not be null", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor()); } if (type.equals(Struct.class)) { throw new SQLFeatureNotSupportedException(); } else if (type.equals(RowId.class)) { return (T) getRowId(columnIndex); } else if (type.equals(NClob.class)) { return (T) getNClob(columnIndex); } else if (type.equals(SQLXML.class)) { return (T) getSQLXML(columnIndex); } return super.getObject(columnIndex, type); }
public void setRowId(int parameterIndex, RowId x) throws SQLException { try { if (this.wrappedStmt != null) { ((PreparedStatement) this.wrappedStmt).setRowId(parameterIndex, x); } else { throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); } } catch (SQLException sqlEx) { checkAndFireConnectionError(sqlEx); } }
private void processRootEvent() throws SyncError { if (rootEvent.getMarker() != null && rootEvent.getMarker().isFailed()) { return; } logger.debug("Started processing RootEvent"); int rowCount = 0; map = (OracleToMongoMap) mappingDao.getMapping(rootEvent.getMapId()); MongoObject mongoObject = map.getMapObject(); getTableCount(mongoObject); logger.info("Table Count :" + tCount); deduceIdealRange(); logger.info("Getting Connection"); rowCount = getCount(mongoObject, rootEvent.getRangeFilter()); //idealRange =10; logger.info("Row count for RootEvent : " + rowCount); if (rowCount > idealRange) { generateOptimalRange(rowCount); if (degree > 1) { this.rangeColumn.setTableAlias(mongoObject.getSourceTables().get(0).getTableAlias()); String tableName = mongoObject.getSourceTables().get(0).getTableName(); String query = ROW_ID_QUERY.replaceFirst("TNAME", tableName); String rowIdQuery = ROW_ID_QUERY_GREATER_THAN_ROWID.replaceFirst("TNAME", tableName); RowId rid = createSubEvents(query, null, tableName, false); while (subEventCount < (degree - 1)) { fetchCount = 0L; rid = createSubEvents(rowIdQuery, rid, tableName, true); } } else { NodeBalancer.INSTANCE.addEventToExecutor(rootEvent); } } else if (rowCount > 0) { NodeBalancer.INSTANCE.addEventToExecutor(rootEvent); } else { eventDao.updateEventStatus(rootEvent.getEventId(), SyncStatus.COMPLETE); } }
public RowId getRowId(String parameterName) throws SQLException { try { if (this.wrappedStmt != null) { return ((CallableStatement) this.wrappedStmt).getRowId(parameterName); } else { throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); } } catch (SQLException sqlEx) { checkAndFireConnectionError(sqlEx); } return null; }
private RowId createSubEvents(final String query, RowId rid, String tableName, boolean isChildQuery) throws SyncError { logger.info("createSubEvents called with parameters : isChildQuery =" + isChildQuery + " , rid = " + rid + " , tableName = " + tableName + " , query = " + query); PreparedStatement rowIdpstmt = null; ResultSet rowIdSet = null; RowId maxRid = null; RowId minRid = null; try { rowIdpstmt = connection.prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); if (isChildQuery) { rowIdpstmt.setRowId(1, rid); } rowIdpstmt.setFetchSize(5000); rowIdSet = rowIdpstmt.executeQuery(); rowIdSet.next(); minRid = rowIdSet.getRowId(1); for (++subEventCount; subEventCount < (degree - 1); subEventCount++) { rowIdSet.relative((int) optimalRange); maxRid = rowIdSet.getRowId(1); getSubEvent(minRid, maxRid, false); minRid = maxRid; fetchCount += optimalRange; if (fetchCount > 1000000L) { break; } } if (subEventCount == (degree - 1)) { rowIdSet.last(); maxRid = rowIdSet.getRowId(1); getSubEvent(minRid, maxRid, true); logger.info("Total subEvents created :" + eventCount); } } catch (Exception e) { logger.error("Error while creating subEvents ", e); throw new SyncError(e); } finally { DbResourceUtils.closeResources(rowIdSet, rowIdpstmt, null); } return maxRid; }
@Override public RowId getRowId(String columnLabel) throws SQLException { throw new UnsupportedOperationException("Not supported yet."); }
@Override public RowId getRowId(String columnLabel) throws SQLException { return null; }
@Override public void setRowId(int parameterIndex, RowId x) throws SQLException { throw new SQLException("Method not supported"); }
@Override public void updateRowId(String columnLabel, RowId x) throws SQLException { throw new SQLFeatureNotSupportedException(); }
@Override public void updateRowId(int columnIndex, RowId x) throws SQLException { throw new UnsupportedOperationException("Not supported yet."); }
public void updateRowId(int columnIndex, RowId x) throws SQLException { throw new NotUpdatable(); }
public RowId getRowId(int parameterIndex) throws SQLException { return realCallableStatement.getRowId(parameterIndex); }
void setRowId(int parameterIndex, RowId x) { parameters.ensureCapacity(parameterIndex+1); }
@Override public void setRowId(int parameterIndex, RowId x) throws SQLException { throw new UnsupportedOperationException("Not supported yet."); }
public RowId getRowId(String columnLabel) throws SQLException { return cacheResultSet.getRowId(columnLabel); }
public void setRowId(int parameterIndex, RowId x) throws SQLException { JDBC4PreparedStatementHelper.setRowId(this, parameterIndex, x); }
public void setRowId(String parameterName, RowId x) throws SQLException { JDBC4PreparedStatementHelper.setRowId(this, getNamedParamIndex(parameterName, false), x); }
@Override public void setRowId(int parameterIndex, RowId x) throws SQLException { // TODO Auto-generated method stub throw new UnsupportedOperationException(); }
@Override public void setRowId(String parameterName, RowId x) throws SQLException { statement.setRowId(parameterName, x); }
public void setRowId(int parameterIndex, RowId x) throws SQLException { argTraceSet(parameterIndex, "(RowId)", x); realPreparedStatement.setRowId(parameterIndex, x); }
@Override public RowId getRowId(int columnIndex) throws SQLException { throw new UnsupportedOperationException("Not supported yet."); }
@Override public void updateRowId(String columnLabel, RowId x) throws SQLException { throw new UnsupportedOperationException("Not supported yet."); }
@Override public RowId getRowId(String parameterName) throws SQLException { return statement.getRowId(parameterName); }
public void updateRowId(String columnLabel, RowId x) throws SQLException { throw new SQLFeatureNotSupportedException(BlancoGenericJdbcConstants.MESSAGE_NO_UPDATE_SUPPORTED); }
@Override public void updateRowId(String columnLabel, RowId x) throws SQLException { }
public RowId getRowId(String columnLabel) throws SQLException { return getRowId(findColumn(columnLabel)); }
@Override public RowId getRowId(String columnLabel) throws SQLException { // TODO Auto-generated method stub return null; }
@Override public RowId getRowId(String parameterName) throws SQLException { return stmt.getRowId(parameterName); }
@Override public void setRowId(String parameterName, RowId x) throws SQLException { throw new UnsupportedOperationException("Not supported yet."); }
@Override public RowId getRowId(int columnIndex) throws SQLException { return null; }
@Override public void updateRowId(int columnIndex, RowId x) throws SQLException { // TODO Auto-generated method stub throw new UnsupportedOperationException(); }