while(sIter.hasNext()) { String sColName = sIter.next(); String iColName = iIter.next().getName(); if((sColName != iColName) && ((sColName == null) || !sColName.equalsIgnoreCase(iColName))) {
public BlobAction(Table _table, Object[] newValues) throws SQLException { this.table = _table; if (!BlobKey.hasPrimaryKey(_table)) { return; } Index pk = _table.getPrimaryKeyIndex(); HashSet<String> hsKey = new HashSet<String>(); for (Index.Column icl : pk.getColumns()) { hsKey.add(icl.getName()); } HashSet<String> hsBlob = new HashSet<String>(); int i = 0; HashMap<String, Object> keyMap = new HashMap<String, Object>(); for (Column cl : _table.getColumns()) { if (cl.getType().equals(DataType.OLE) && newValues[i] != null) { containsBlob = true; hsBlob.add(cl.getName()); } if (hsKey.contains(cl.getName())) { keyMap.put(cl.getName(), newValues[i]); } ++i; } for (String cln : hsBlob) { keys.add(new BlobKey(keyMap, table.getName(), cln)); } }
private boolean isPrimaryColumn(String tableName, com.healthmarketscience.jackcess.Column originalColumn) throws IOException { for (Index index : jackcessDatabase.getTable(tableName).getIndexes()) { if (index.isPrimaryKey()) { for (Index.Column indexColumn : index.getColumns()) { if (indexColumn.getName().equals(originalColumn.getName())) { return true; } } } } boolean hasPrimaryKey = false; for (Index index : jackcessDatabase.getTable(tableName).getIndexes()) { if (index.isPrimaryKey()) { hasPrimaryKey = true; } } return originalColumn.isAutoNumber() && !hasPrimaryKey; }
public BlobKey(Table _table, String _columnName, Row _row) { this.tableName = _table.getName(); this.columnName = _columnName; if (hasPrimaryKey(_table)) { List<? extends Index.Column> cl = _table.getPrimaryKeyIndex().getColumns(); HashMap<String, Object> keyMap = new HashMap<String, Object>(); for (Index.Column c : cl) { keyMap.put(c.getName(), _row.get(c.getName())); } this.key = keyMap; } }