@Override
public void add(Session session, Row row) {
if (indexType.isUnique()) {
byte[] key = getStartKey(row);
Prepared p = session.prepare(select, true);
p.getParameters().get(0).setValue(ValueString.get(Bytes.toString(key)));
ResultInterface r = p.query(1);
try {
if (r.next()) {
SearchRow r2 = getRow(new Buffer(Bytes.toBytes(r.currentRow()[0].getString())));
if (compareRows(row, r2) == 0) {
if (!containsNullAndAllowMultipleNull(r2)) {
throw getDuplicateKeyException();
}
}
}
} finally {
r.close();
}
}
Prepared p = session.prepare(insert, true);
p.getParameters().get(0).setValue(ValueString.get(Bytes.toString(getKey(row))));
p.update();
}