GP-0 avoid unnecessary DB write for DBStringMapAdapter

This commit is contained in:
ghidra1 2023-04-20 20:44:14 -04:00
parent cd4452ace9
commit 61a2b8335c

View file

@ -19,6 +19,8 @@ import java.io.IOException;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import db.*; import db.*;
/** /**
@ -48,6 +50,9 @@ public class DBStringMapAdapter {
} }
public void put(String key, String value) throws IOException { public void put(String key, String value) throws IOException {
if (StringUtils.equals(value, get(key))) {
return;
}
DBRecord record = SCHEMA.createRecord(new StringField(key)); DBRecord record = SCHEMA.createRecord(new StringField(key));
record.setString(0, value); record.setString(0, value);
table.putRecord(record); table.putRecord(record);