private String commaSeparated(List<? extends Index.Column> columns, boolean escape) throws SQLException { String comma = ""; StringBuffer sb = new StringBuffer(" ("); for (Index.Column cd : columns) { String cl = escape ? escapeIdentifier(cd.getColumn().getName()) : cd.getColumn().getName(); sb.append(comma).append(cl); comma = ","; } return sb.append(") ").toString(); }
/** * Fills in the _entryValues with the relevant info from the given "from" * table row. */ private void toEntryValues(Object[] fromRow) { for(int i = 0; i < _entryValues.length; ++i) { _entryValues[i] = _fromCols.get(i).getColumn().getRowValue(fromRow); } }
/** * Fills in the _entryValues with the relevant info from the given "from" * table row. */ private void toEntryValues(Map<String,?> fromRow) { for(int i = 0; i < _entryValues.length; ++i) { _entryValues[i] = _fromCols.get(i).getColumn().getRowValue(fromRow); } }
boolean pk = idx.isPrimaryKey(); if (!uk && !pk && idx.getColumns().size() == 1) { Column cl = idx.getColumns().get(0).getColumn(); if (this.alreadyIndexed.contains(cl)) { return; Column cl = idx.getColumns().get(0).getColumn(); DataType dt = cl.getType(); if (dt.equals(DataType.COMPLEX_TYPE)) { if (cd.getColumn().getType().equals(DataType.COMPLEX_TYPE)) { return;
private static void updateSecondaryValues(Joiner joiner, Object[] oldFromRow, Object[] newFromRow) throws IOException { IndexCursor toCursor = joiner.getToCursor(); List<? extends Index.Column> fromCols = joiner.getColumns(); List<? extends Index.Column> toCols = joiner.getToIndex().getColumns(); Object[] toRow = new Object[joiner.getToTable().getColumnCount()]; for(Iterator<Row> iter = joiner.findRows(oldFromRow) .setColumnNames(Collections.<String>emptySet()) .iterator(); iter.hasNext(); ) { iter.next(); // create update row for "to" table Arrays.fill(toRow, Column.KEEP_VALUE); for(int i = 0; i < fromCols.size(); ++i) { Object val = fromCols.get(i).getColumn().getRowValue(newFromRow); toCols.get(i).getColumn().setRowValue(toRow, val); } toCursor.updateCurrentRow(toRow); } }
private static void nullSecondaryValues(Joiner joiner, Object[] oldFromRow) throws IOException { IndexCursor toCursor = joiner.getToCursor(); List<? extends Index.Column> fromCols = joiner.getColumns(); List<? extends Index.Column> toCols = joiner.getToIndex().getColumns(); Object[] toRow = new Object[joiner.getToTable().getColumnCount()]; for(Iterator<Row> iter = joiner.findRows(oldFromRow) .setColumnNames(Collections.<String>emptySet()) .iterator(); iter.hasNext(); ) { iter.next(); // create update row for "to" table Arrays.fill(toRow, Column.KEEP_VALUE); for(int i = 0; i < fromCols.size(); ++i) { toCols.get(i).getColumn().setRowValue(toRow, null); } toCursor.updateCurrentRow(toRow); } }
private static boolean anyUpdates(Joiner joiner,Object[] oldRow, Object[] newRow) { Table fromTable = joiner.getFromTable(); for(Index.Column iCol : joiner.getColumns()) { Column col = iCol.getColumn(); if(!MATCHER.matches(fromTable, col.getName(), col.getRowValue(oldRow), col.getRowValue(newRow))) { return true; } } return false; }
private static boolean areNull(Joiner joiner, Object[] row) { for(Index.Column col : joiner.getColumns()) { if(col.getColumn().getRowValue(row) != null) { return false; } } return true; }