Renamed Record class to DBRecord

This commit is contained in:
ghidra1 2020-12-28 13:30:36 -05:00
parent 04276e9522
commit db1e3d1b62
305 changed files with 1902 additions and 1959 deletions

View file

@ -22,7 +22,7 @@ import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.util.*;
import db.Record;
import db.DBRecord;
import ghidra.program.model.address.KeyRange;
/**
@ -81,13 +81,13 @@ public class DBObjectCache<T extends DatabaseObject> {
* Retrieves the database object with the given record and associated key from the cache.
* This form should be used in conjunction with record iterators to avoid unnecessary
* record query during a possible object refresh. To benefit from the record the cached
* object must implement the {@link DatabaseObject#refresh(Record)} method which by default
* object must implement the {@link DatabaseObject#refresh(DBRecord)} method which by default
* ignores the record and simply calls {@link DatabaseObject#refresh()}.
* @param objectRecord the valid record corresponding to the object to be retrieved and possibly
* used to refresh the associated object if found in cache
* @return the cached object or null if the object with that key is not currently cached.
*/
public synchronized T get(Record objectRecord) {
public synchronized T get(DBRecord objectRecord) {
long key = objectRecord.getKey();
KeyedSoftReference ref = map.get(key);
if (ref != null) {

View file

@ -384,7 +384,7 @@ public class DataTypeArchiveDB extends DomainObjectAdapterDB
private void createDatabase() throws IOException {
table = dbh.createTable(TABLE_NAME, SCHEMA);
Record record = SCHEMA.createRecord(new StringField(ARCHIVE_DB_VERSION));
DBRecord record = SCHEMA.createRecord(new StringField(ARCHIVE_DB_VERSION));
record.setString(0, Integer.toString(DB_VERSION));
table.putRecord(record);
}
@ -430,13 +430,13 @@ public class DataTypeArchiveDB extends DomainObjectAdapterDB
private void upgradeDatabase() throws IOException {
table = dbh.getTable(TABLE_NAME);
Record record = SCHEMA.createRecord(new StringField(ARCHIVE_DB_VERSION));
DBRecord record = SCHEMA.createRecord(new StringField(ARCHIVE_DB_VERSION));
record.setString(0, Integer.toString(DB_VERSION));
table.putRecord(record);
}
private int getStoredVersion() throws IOException {
Record record = table.getRecord(new StringField(ARCHIVE_DB_VERSION));
DBRecord record = table.getRecord(new StringField(ARCHIVE_DB_VERSION));
// DB Version
// if record does not exist return 1;

View file

@ -291,7 +291,7 @@ class DataTypeArchiveDBChangeSet implements DataTypeArchiveChangeSet, DomainObje
}
RecordIterator it = table.iterator();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
ids.add(rec.getLongValue(0));
}
}
@ -321,7 +321,7 @@ class DataTypeArchiveDBChangeSet implements DataTypeArchiveChangeSet, DomainObje
private void writeIdRecords(DBHandle dbh, String tableName, Set<Long> ids) throws IOException {
if (ids.size() > 0) {
Table table = dbh.createTable(tableName, STORED_ID_SCHEMA);
Record rec = STORED_ID_SCHEMA.createRecord(0);
DBRecord rec = STORED_ID_SCHEMA.createRecord(0);
int key = 1;
for (long id : ids) {
rec.setKey(key++);

View file

@ -17,7 +17,7 @@ package ghidra.program.database;
import java.util.ConcurrentModificationException;
import db.Record;
import db.DBRecord;
import ghidra.util.Lock;
/**
@ -140,7 +140,7 @@ abstract public class DatabaseObject {
* @param record optional record which may be used to refresh invalid object
* @return true if the object is valid.
*/
public boolean checkIsValid(Record record) {
public boolean checkIsValid(DBRecord record) {
if (deleted) {
return false;
}
@ -199,7 +199,7 @@ abstract public class DatabaseObject {
* object was deleted. Objects that extend this class must implement a refresh method.
* If an object can never refresh itself, then it should always return false.
*/
protected boolean refresh(Record record) {
protected boolean refresh(DBRecord record) {
return refresh();
}
}

View file

@ -54,7 +54,7 @@ class OverlaySpaceAdapterDB {
if (table != null) {
RecordIterator it = table.iterator();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
String spaceName = rec.getString(OV_SPACE_NAME_COL);
String templateSpaceName = rec.getString(OV_SPACE_BASE_COL);
long minOffset = rec.getLongValue(OV_MIN_OFFSET_COL);
@ -86,7 +86,7 @@ class OverlaySpaceAdapterDB {
if (table == null) {
table = db.createTable(TABLE_NAME, SCHEMA);
}
Record rec = SCHEMA.createRecord(table.getKey());
DBRecord rec = SCHEMA.createRecord(table.getKey());
rec.setString(0, ovSpace.getName());
rec.setString(1, ovSpace.getOverlayedSpace().getName());
rec.setLongValue(OV_MIN_OFFSET_COL, ovSpace.getMinOffset());
@ -105,7 +105,7 @@ class OverlaySpaceAdapterDB {
if (table != null) {
RecordIterator it = table.iterator();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
String spaceName = rec.getString(0);
if (name.equals(spaceName)) {
it.delete();
@ -127,7 +127,7 @@ class OverlaySpaceAdapterDB {
if (table != null) {
RecordIterator it = table.iterator();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
OverlayAddressSpace space = map.remove(rec.getKey());
if (space != null) {
//maxId = Math.max(maxId, space.getUnique());
@ -173,7 +173,7 @@ class OverlaySpaceAdapterDB {
if (table != null) {
RecordIterator it = table.iterator();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
String spaceName = rec.getString(0);
if (oldName.equals(spaceName)) {
it.delete();
@ -202,7 +202,7 @@ class OverlaySpaceAdapterDB {
if (table != null) {
RecordIterator it = table.iterator();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
String oldUnderlyingSpaceName = rec.getString(OV_SPACE_BASE_COL);
AddressSpace space = addrFactory.getAddressSpace(oldUnderlyingSpaceName);
if (space != null && space.isNonLoadedMemorySpace()) {

View file

@ -1155,7 +1155,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
if (name.equals(newName)) {
return;
}
Record record = table.getRecord(new StringField(PROGRAM_NAME));
DBRecord record = table.getRecord(new StringField(PROGRAM_NAME));
record.setString(0, newName);
table.putRecord(record);
getTreeManager().setProgramName(name, newName);
@ -1170,7 +1170,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
}
private void refreshName() throws IOException {
Record record = table.getRecord(new StringField(PROGRAM_NAME));
DBRecord record = table.getRecord(new StringField(PROGRAM_NAME));
name = record.getString(0);
}
@ -1265,7 +1265,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
}
private long getStoredBaseImageOffset() throws IOException {
Record rec = table.getRecord(new StringField(IMAGE_OFFSET));
DBRecord rec = table.getRecord(new StringField(IMAGE_OFFSET));
if (rec != null) {
return (new BigInteger(rec.getString(0), 16)).longValue();
}
@ -1325,7 +1325,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
if (commit) {
try {
Record record = SCHEMA.createRecord(new StringField(IMAGE_OFFSET));
DBRecord record = SCHEMA.createRecord(new StringField(IMAGE_OFFSET));
record.setString(0, Long.toHexString(base.getOffset()));
table.putRecord(record);
@ -1384,7 +1384,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
private void createDatabase() throws IOException {
table = dbh.createTable(TABLE_NAME, SCHEMA);
Record record = SCHEMA.createRecord(new StringField(PROGRAM_NAME));
DBRecord record = SCHEMA.createRecord(new StringField(PROGRAM_NAME));
record.setString(0, name);
table.putRecord(record);
@ -1432,7 +1432,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
if (table == null) {
throw new IOException("Unsupported File Content");
}
Record record = table.getRecord(new StringField(PROGRAM_NAME));
DBRecord record = table.getRecord(new StringField(PROGRAM_NAME));
name = record.getString(0);
record = table.getRecord(new StringField(LANGUAGE_ID));
@ -1501,7 +1501,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
table = dbh.getTable(TABLE_NAME);
Field key = new StringField(PROGRAM_DB_VERSION);
String versionStr = Integer.toString(DB_VERSION);
Record record = table.getRecord(key);
DBRecord record = table.getRecord(key);
if (record != null && versionStr.equals(record.getString(0))) {
return; // already has correct version
}
@ -1534,7 +1534,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
}
public int getStoredVersion() throws IOException {
Record record = table.getRecord(new StringField(PROGRAM_DB_VERSION));
DBRecord record = table.getRecord(new StringField(PROGRAM_DB_VERSION));
if (record != null) {
String s = record.getString(0);
try {
@ -1549,7 +1549,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
private void checkOldProperties(int openMode, TaskMonitor monitor)
throws IOException, VersionException {
Record record = table.getRecord(new StringField(EXECUTE_PATH));
DBRecord record = table.getRecord(new StringField(EXECUTE_PATH));
if (record != null) {
if (openMode == READ_ONLY) {
return; // not important, get on path or format will return "unknown"
@ -2098,7 +2098,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
translator.fixupInstructions(this, translator.getOldLanguage(), monitor);
}
Record record = SCHEMA.createRecord(new StringField(LANGUAGE_ID));
DBRecord record = SCHEMA.createRecord(new StringField(LANGUAGE_ID));
record.setString(0, languageID.getIdAsString());
table.putRecord(record);
record = SCHEMA.createRecord(new StringField(COMPILER_SPEC_ID));

View file

@ -542,7 +542,7 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
}
RecordIterator it = table.iterator();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
ids.add(rec.getLongValue(0));
}
}
@ -557,7 +557,7 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
}
RecordIterator it = table.iterator();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
Address addr1 = addrMap.decodeAddress(rec.getLongValue(0));
Address addr2 = addrMap.decodeAddress(rec.getLongValue(1));
// Memory addresses or external addresses are the only ones that should be in here.
@ -611,7 +611,7 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
private void writeIdRecords(DBHandle dbh, String tableName, Set<Long> ids) throws IOException {
if (ids.size() > 0) {
Table table = dbh.createTable(tableName, STORED_ID_SCHEMA);
Record rec = STORED_ID_SCHEMA.createRecord(0);
DBRecord rec = STORED_ID_SCHEMA.createRecord(0);
int key = 1;
for (long id : ids) {
rec.setKey(key++);
@ -625,7 +625,7 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
throws IOException {
if (!set.isEmpty()) {
Table table = dbh.createTable(tableName, STORED_ADDRESS_RANGE_SCHEMA);
Record rec = STORED_ADDRESS_RANGE_SCHEMA.createRecord(0);
DBRecord rec = STORED_ADDRESS_RANGE_SCHEMA.createRecord(0);
int key = 1;
for (KeyRange range : addrMap.getKeyRanges(set, false, false)) {
rec.setKey(key++);

View file

@ -324,7 +324,7 @@ class ProgramUserDataDB extends DomainObjectAdapterDB implements ProgramUserData
registryTable =
dbh.createTable(REGISTRY_TABLE_NAME, REGISTRY_SCHEMA, new int[] { PROPERTY_OWNER_COL });
Record record = SCHEMA.createRecord(new StringField(LANGUAGE_ID));
DBRecord record = SCHEMA.createRecord(new StringField(LANGUAGE_ID));
record.setString(VALUE_COL, languageID.getIdAsString());
table.putRecord(record);
@ -347,7 +347,7 @@ class ProgramUserDataDB extends DomainObjectAdapterDB implements ProgramUserData
throw new IOException("Unsupported User Data File Content");
}
Record record = table.getRecord(new StringField(LANGUAGE_ID));
DBRecord record = table.getRecord(new StringField(LANGUAGE_ID));
languageID = new LanguageID(record.getString(VALUE_COL));
record = table.getRecord(new StringField(LANGUAGE_VERSION));
@ -377,7 +377,7 @@ class ProgramUserDataDB extends DomainObjectAdapterDB implements ProgramUserData
private void upgradeDatabase() throws IOException {
table = dbh.getTable(TABLE_NAME);
Record record = SCHEMA.createRecord(new StringField(STORED_DB_VERSION));
DBRecord record = SCHEMA.createRecord(new StringField(STORED_DB_VERSION));
record.setString(VALUE_COL, Integer.toString(DB_VERSION));
table.putRecord(record);
}
@ -438,7 +438,7 @@ class ProgramUserDataDB extends DomainObjectAdapterDB implements ProgramUserData
clearCache(true);
Record record = SCHEMA.createRecord(new StringField(LANGUAGE_ID));
DBRecord record = SCHEMA.createRecord(new StringField(LANGUAGE_ID));
record.setString(VALUE_COL, languageID.getIdAsString());
table.putRecord(record);
@ -472,7 +472,7 @@ class ProgramUserDataDB extends DomainObjectAdapterDB implements ProgramUserData
try {
for (Field key : registryTable.findRecords(new StringField(owner),
PROPERTY_OWNER_COL)) {
Record rec = registryTable.getRecord(key);
DBRecord rec = registryTable.getRecord(key);
if (propertyName.equals(rec.getString(PROPERTY_NAME_COL))) {
int type = rec.getIntValue(PROPERTY_TYPE_COL);
if (propertyType != type) {
@ -495,7 +495,7 @@ class ProgramUserDataDB extends DomainObjectAdapterDB implements ProgramUserData
}
long key = registryTable.getKey();
Record rec = REGISTRY_SCHEMA.createRecord(key);
DBRecord rec = REGISTRY_SCHEMA.createRecord(key);
rec.setString(PROPERTY_OWNER_COL, owner);
rec.setString(PROPERTY_NAME_COL, propertyName);
rec.setIntValue(PROPERTY_TYPE_COL, propertyType);
@ -526,7 +526,7 @@ class ProgramUserDataDB extends DomainObjectAdapterDB implements ProgramUserData
return null;
}
private PropertyMap getPropertyMap(Record rec) throws IOException {
private PropertyMap getPropertyMap(DBRecord rec) throws IOException {
try {
PropertyMap map;
int type = rec.getIntValue(PROPERTY_TYPE_COL);
@ -579,7 +579,7 @@ class ProgramUserDataDB extends DomainObjectAdapterDB implements ProgramUserData
try {
for (Field key : registryTable.findRecords(new StringField(owner),
PROPERTY_OWNER_COL)) {
Record rec = registryTable.getRecord(key);
DBRecord rec = registryTable.getRecord(key);
list.add(getPropertyMap(rec));
}
}
@ -596,7 +596,7 @@ class ProgramUserDataDB extends DomainObjectAdapterDB implements ProgramUserData
propertyMapOwners = new HashSet<String>();
RecordIterator recIter = registryTable.iterator();
while (recIter.hasNext()) {
Record rec = recIter.next();
DBRecord rec = recIter.next();
propertyMapOwners.add(rec.getString(PROPERTY_OWNER_COL));
}
}

View file

@ -15,7 +15,7 @@
*/
package ghidra.program.database.bookmark;
import db.Record;
import db.DBRecord;
import ghidra.program.database.DBObjectCache;
import ghidra.program.database.DatabaseObject;
import ghidra.program.model.address.Address;
@ -28,9 +28,9 @@ import ghidra.program.model.listing.BookmarkType;
public class BookmarkDB extends DatabaseObject implements Bookmark {
private BookmarkDBManager mgr;
private Record record;
private DBRecord record;
BookmarkDB(BookmarkDBManager mgr, DBObjectCache<BookmarkDB> cache, Record record) {
BookmarkDB(BookmarkDBManager mgr, DBObjectCache<BookmarkDB> cache, DBRecord record) {
super(cache, record.getKey());
this.mgr = mgr;
this.record = record;
@ -46,7 +46,7 @@ public class BookmarkDB extends DatabaseObject implements Bookmark {
* Update associated record
* @param rec
*/
void setRecord(Record rec) {
void setRecord(DBRecord rec) {
if (rec.getKey() != key) {
throw new IllegalArgumentException("Key mismatch");
}
@ -121,7 +121,7 @@ public class BookmarkDB extends DatabaseObject implements Bookmark {
}
@Override
protected boolean refresh(Record rec) {
protected boolean refresh(DBRecord rec) {
if (rec == null) {
rec = mgr.getRecord(key);
}
@ -136,7 +136,7 @@ public class BookmarkDB extends DatabaseObject implements Bookmark {
* Returns record associated with this bookmark or
* null if bookmark has been deleted.
*/
Record getRecord() {
DBRecord getRecord() {
return checkIsValid() ? record : null;
}

View file

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -117,7 +116,7 @@ abstract class BookmarkDBAdapter {
if (monitor.isCancelled()) {
throw new IOException("Upgrade Cancelled");
}
Record rec = it.next();
DBRecord rec = it.next();
int typeId = getTypeId(rec);
tmpAdapter.addType(typeId);
Address addr = oldAddrMap.decodeAddress(rec.getLongValue(ADDRESS_COL));
@ -138,7 +137,7 @@ abstract class BookmarkDBAdapter {
if (monitor.isCancelled()) {
throw new IOException("Upgrade Cancelled");
}
Record rec = it.next();
DBRecord rec = it.next();
newAdapter.updateRecord(rec);
monitor.setProgress(++cnt);
}
@ -151,7 +150,7 @@ abstract class BookmarkDBAdapter {
}
}
static int getTypeId(Record rec) {
static int getTypeId(DBRecord rec) {
long key = rec.getKey();
return (int) (key >> 48);
}
@ -181,7 +180,7 @@ abstract class BookmarkDBAdapter {
* @return
* @throws IOException
*/
Record createBookmark(int typeId, String category, long index, String comment)
DBRecord createBookmark(int typeId, String category, long index, String comment)
throws IOException {
throw new UnsupportedOperationException("Bookmarks are read-only and may not be created");
}
@ -191,7 +190,7 @@ abstract class BookmarkDBAdapter {
* @param rec modified bookmark record
* @throws IOException
*/
void updateRecord(Record rec) throws IOException {
void updateRecord(DBRecord rec) throws IOException {
throw new UnsupportedOperationException("Bookmarks are read-only and may not be modified");
}
@ -209,7 +208,7 @@ abstract class BookmarkDBAdapter {
* @param id bookmark ID
* @return bookmark record or null if not found.
*/
abstract Record getRecord(long id) throws IOException;
abstract DBRecord getRecord(long id) throws IOException;
/**
* Get all bookmark records associated with a specific type and address.

View file

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -55,7 +54,7 @@ class BookmarkDBAdapterV0 extends BookmarkDBAdapter {
catch (VersionException e) {
throw new AssertException();
}
Record[] oldTypes = oldMgr.getTypeRecords();
DBRecord[] oldTypes = oldMgr.getTypeRecords();
if (oldTypes.length == 0) {
return;
}
@ -88,7 +87,7 @@ class BookmarkDBAdapterV0 extends BookmarkDBAdapter {
}
@Override
Record getRecord(long id) throws IOException {
DBRecord getRecord(long id) throws IOException {
return conversionAdapter.getRecord(id);
}

View file

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -75,7 +74,7 @@ class BookmarkDBAdapterV1 extends BookmarkDBAdapter {
AddressSet set = new AddressSet();
RecordIterator recordIter = getRecordsByType(typeId);
while (recordIter.hasNext()) {
Record rec = recordIter.next();
DBRecord rec = recordIter.next();
Address addr = addrMap.decodeAddress(rec.getLongValue(V1_ADDRESS_COL));
set.addRange(addr, addr);
}
@ -88,7 +87,7 @@ class BookmarkDBAdapterV1 extends BookmarkDBAdapter {
Field fv = new LongField(typeId);
RecordIterator recordIter = table.indexIterator(V1_TYPE_ID_COL, fv, fv, true);
while (recordIter.hasNext()) {
Record rec = recordIter.next();
DBRecord rec = recordIter.next();
String cat = demangleTypeCategory(rec.getString(V1_TYPE_CATEGORY_COL));
set.add(cat);
}
@ -99,13 +98,13 @@ class BookmarkDBAdapterV1 extends BookmarkDBAdapter {
}
@Override
Record getRecord(long id) throws IOException {
DBRecord getRecord(long id) throws IOException {
return convertV1Record(table.getRecord(id));
}
private static Record convertV1Record(Record record) {
private static DBRecord convertV1Record(DBRecord record) {
long key = record.getLongValue(V1_TYPE_ID_COL) << 48 | (record.getKey() & 0xffffffffL);
Record rec = BookmarkDBAdapter.SCHEMA.createRecord(key);
DBRecord rec = BookmarkDBAdapter.SCHEMA.createRecord(key);
rec.setLongValue(BookmarkDBAdapter.ADDRESS_COL, record.getLongValue(V1_ADDRESS_COL));
rec.setString(BookmarkDBAdapter.CATEGORY_COL,
demangleTypeCategory(record.getString(V1_TYPE_CATEGORY_COL)));
@ -177,10 +176,10 @@ class BookmarkDBAdapterV1 extends BookmarkDBAdapter {
//==================================================================================================
private class BatchRecordIterator implements RecordIterator {
private ListIterator<Record> iter;
private ListIterator<DBRecord> iter;
BatchRecordIterator(int typeId, long start, long end) throws IOException {
ArrayList<Record> list = new ArrayList<Record>();
ArrayList<DBRecord> list = new ArrayList<DBRecord>();
Field sf = new LongField(start);
Field ef = new LongField(end);
RecordIterator recIter = table.indexIterator(V1_ADDRESS_COL, sf, ef, true);
@ -201,12 +200,12 @@ class BookmarkDBAdapterV1 extends BookmarkDBAdapter {
}
@Override
public Record next() throws IOException {
public DBRecord next() throws IOException {
return iter.next();
}
@Override
public Record previous() throws IOException {
public DBRecord previous() throws IOException {
return iter.previous();
}
@ -223,7 +222,7 @@ class BookmarkDBAdapterV1 extends BookmarkDBAdapter {
}
@Override
protected Record convertRecord(Record record) {
protected DBRecord convertRecord(DBRecord record) {
return convertV1Record(record);
}
}

View file

@ -107,7 +107,7 @@ public class BookmarkDBAdapterV3 extends BookmarkDBAdapter {
}
@Override
Record getRecord(long id) throws IOException {
DBRecord getRecord(long id) throws IOException {
Table table = getTable(id);
if (table == null) {
return null;
@ -160,7 +160,7 @@ public class BookmarkDBAdapterV3 extends BookmarkDBAdapter {
// TODO: This is very inefficient but is just as fast as using the index iterator
// Employing a separate category table would be faster
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
String cat = rec.getString(V3_CATEGORY_COL);
if (cat != null && cat.length() != 0) {
set.add(cat);
@ -175,7 +175,7 @@ public class BookmarkDBAdapterV3 extends BookmarkDBAdapter {
AddressSet set = new AddressSet();
RecordIterator recordIter = getRecordsByType(typeID);
while (recordIter.hasNext()) {
Record rec = recordIter.next();
DBRecord rec = recordIter.next();
Address addr = addressMap.decodeAddress(rec.getLongValue(V3_ADDRESS_COL));
set.addRange(addr, addr);
}
@ -200,7 +200,7 @@ public class BookmarkDBAdapterV3 extends BookmarkDBAdapter {
}
@Override
Record createBookmark(int typeID, String category, long index, String comment)
DBRecord createBookmark(int typeID, String category, long index, String comment)
throws IOException {
if (!hasTable(typeID)) {
return null;
@ -210,7 +210,7 @@ public class BookmarkDBAdapterV3 extends BookmarkDBAdapter {
long nextId = table.getKey() + 1;
long id = ((long) typeID << TYPE_ID_OFFSET) | nextId;
Record rec = V3_SCHEMA.createRecord(id);
DBRecord rec = V3_SCHEMA.createRecord(id);
rec.setLongValue(V3_ADDRESS_COL, index);
rec.setString(V3_CATEGORY_COL, category);
rec.setString(V3_COMMENT_COL, comment);
@ -225,7 +225,7 @@ public class BookmarkDBAdapterV3 extends BookmarkDBAdapter {
}
@Override
void updateRecord(Record rec) throws IOException {
void updateRecord(DBRecord rec) throws IOException {
Table table = getTable(rec.getKey());
table.putRecord(rec);
}

View file

@ -96,8 +96,8 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
TaskMonitor.DUMMY);
}
Record[] typeRecords = bookmarkTypeAdapter.getRecords();
for (Record rec : typeRecords) {
DBRecord[] typeRecords = bookmarkTypeAdapter.getRecords();
for (DBRecord rec : typeRecords) {
int typeId = (int) rec.getKey();
BookmarkTypeDB type =
new BookmarkTypeDB(typeId, rec.getString(BookmarkTypeDBAdapter.TYPE_NAME_COL));
@ -157,7 +157,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
void bookmarkChanged(BookmarkDB bm) {
lock.acquire();
try {
Record rec = bm.getRecord();
DBRecord rec = bm.getRecord();
if (rec != null) {
bookmarkAdapter.updateRecord(rec);
Address addr = bm.getAddress();
@ -179,11 +179,11 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
private void upgradeOldBookmarks(ProgramDB programDB) {
OldBookmarkManager oldMgr = new OldBookmarkManager(programDB);
Record[] oldTypes = oldMgr.getTypeRecords();
DBRecord[] oldTypes = oldMgr.getTypeRecords();
if (oldTypes.length == 0) {
return;
}
for (Record oldType : oldTypes) {
for (DBRecord oldType : oldTypes) {
String type = oldType.getString(BookmarkTypeDBAdapter.TYPE_NAME_COL);
AddressIterator iter = oldMgr.getBookmarkAddresses(type);
while (iter.hasNext()) {
@ -296,7 +296,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
bm.setComment(comment);
}
else {
Record rec = bookmarkAdapter.createBookmark(typeId, category,
DBRecord rec = bookmarkAdapter.createBookmark(typeId, category,
addrMap.getKey(addr, true), comment);
bm = new BookmarkDB(this, cache, rec);
@ -315,7 +315,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
return null;
}
private BookmarkDB getBookmark(Record bookmarkRecord) {
private BookmarkDB getBookmark(DBRecord bookmarkRecord) {
BookmarkDB bm = cache.get(bookmarkRecord);
if (bm == null) {
bm = new BookmarkDB(this, cache, bookmarkRecord);
@ -333,7 +333,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
RecordIterator iter =
bookmarkAdapter.getRecordsByTypeAtAddress(typeId, addrMap.getKey(addr, false));
while (iter.hasNext()) {
Record rec = iter.next();
DBRecord rec = iter.next();
String cat = rec.getString(BookmarkDBAdapter.CATEGORY_COL);
if (category.equals(cat)) {
return getBookmark(rec);
@ -430,7 +430,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
RecordIterator iter =
bookmarkAdapter.getRecordsByTypeAndCategory(bmt.getTypeId(), category);
while (iter.hasNext()) {
Record rec = iter.next();
DBRecord rec = iter.next();
BookmarkDB bm = getBookmark(rec);
removeBookmark(bm);
monitor.checkCanceled();
@ -458,8 +458,8 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
* @param id bookmark ID
* @return bookmark record
*/
Record getRecord(long id) {
Record rec = null;
DBRecord getRecord(long id) {
DBRecord rec = null;
try {
rec = bookmarkAdapter.getRecord(id);
}
@ -498,7 +498,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
RecordIterator iter =
bookmarkAdapter.getRecordsByTypeAtAddress(typeId, addrMap.getKey(addr, false));
while (iter.hasNext()) {
Record rec = iter.next();
DBRecord rec = iter.next();
list.add(getBookmark(rec));
}
}
@ -626,7 +626,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
try {
BookmarkDB bm = cache.get(id);
if (bm == null) {
Record record = bookmarkAdapter.getRecord(id);
DBRecord record = bookmarkAdapter.getRecord(id);
if (record == null) {
return null;
}
@ -847,7 +847,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
lock.acquire();
try {
while (nextBookmark == null && (forward ? it.hasNext() : it.hasPrevious())) {
Record record = forward ? it.next() : it.previous();
DBRecord record = forward ? it.next() : it.previous();
nextBookmark = getBookmark(record);
}
}

View file

@ -85,13 +85,13 @@ abstract class BookmarkTypeDBAdapter {
* @return array of records
* @throws IOException
*/
abstract Record[] getRecords() throws IOException;
abstract DBRecord[] getRecords() throws IOException;
public int[] getTypeIds() throws IOException {
Record[] typeRecords = getRecords();
DBRecord[] typeRecords = getRecords();
int[] ids = new int[typeRecords.length];
for (int i = 0; i < typeRecords.length; i++) {
Record rec = typeRecords[i];
DBRecord rec = typeRecords[i];
ids[i] = (int) rec.getKey();
}
return ids;

View file

@ -18,14 +18,14 @@ package ghidra.program.database.bookmark;
import java.io.IOException;
import db.DBHandle;
import db.Record;
import db.DBRecord;
/**
*
*/
public class BookmarkTypeDBAdapterNoTable extends BookmarkTypeDBAdapter {
private Record[] records = new Record[0];
private DBRecord[] records = new DBRecord[0];
/**
* @param dbHandle the database handle
@ -44,7 +44,7 @@ public class BookmarkTypeDBAdapterNoTable extends BookmarkTypeDBAdapter {
}
@Override
Record[] getRecords() throws IOException {
DBRecord[] getRecords() throws IOException {
return records;
}

View file

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -44,13 +43,13 @@ public class BookmarkTypeDBAdapterV0 extends BookmarkTypeDBAdapter {
}
@Override
Record[] getRecords() throws IOException {
ArrayList<Record> list = new ArrayList<Record>();
DBRecord[] getRecords() throws IOException {
ArrayList<DBRecord> list = new ArrayList<DBRecord>();
RecordIterator iter = table.iterator();
while (iter.hasNext()) {
list.add(iter.next());
}
Record[] recs = new Record[list.size()];
DBRecord[] recs = new DBRecord[list.size()];
list.toArray(recs);
return recs;
}
@ -58,7 +57,7 @@ public class BookmarkTypeDBAdapterV0 extends BookmarkTypeDBAdapter {
@Override
void addType(int typeId, String type) throws IOException {
Record rec = SCHEMA.createRecord(typeId);
DBRecord rec = SCHEMA.createRecord(typeId);
rec.setString(TYPE_NAME_COL, type);
table.putRecord(rec);
}

View file

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,7 +25,7 @@ import ghidra.util.exception.DuplicateNameException;
import java.util.*;
import db.Record;
import db.DBRecord;
/**
* Interface to manage bookmarks on a program.
@ -41,7 +40,7 @@ class OldBookmarkManager {
private Program program;
private PropertyMapManager propertyMgr;
private HashMap<String, Record> bookmarkTypes = new HashMap<String, Record>(); // maps type to record
private HashMap<String, DBRecord> bookmarkTypes = new HashMap<String, DBRecord>(); // maps type to record
// private ArrayList bookmarks = new ArrayList();
// private LongIntHashedList bookmarkAddrIndex = new LongIntHashedList();
@ -56,7 +55,7 @@ class OldBookmarkManager {
// Create type records
String[] types = getTypes();
for (int i = 0; i < types.length; i++) {
Record rec = BookmarkTypeDBAdapter.SCHEMA.createRecord(i);
DBRecord rec = BookmarkTypeDBAdapter.SCHEMA.createRecord(i);
rec.setString(BookmarkTypeDBAdapter.TYPE_NAME_COL, types[i]);
bookmarkTypes.put(types[i], rec);
}
@ -189,9 +188,9 @@ class OldBookmarkManager {
/**
* Returns array of bookmark type records
*/
public Record[] getTypeRecords() {
Collection<Record> c = bookmarkTypes.values();
Record[] recs = new Record[c.size()];
public DBRecord[] getTypeRecords() {
Collection<DBRecord> c = bookmarkTypes.values();
DBRecord[] recs = new DBRecord[c.size()];
c.toArray(recs);
return recs;
}

View file

@ -260,12 +260,12 @@ public class CodeManager implements ErrorHandler, ManagerDB {
Instruction inst = null;
RecordIterator recIt = instAdapter.getRecords(firstInstrStart, true);
if (recIt.hasNext()) {
Record rec = recIt.next();
DBRecord rec = recIt.next();
inst = getInstructionDB(rec);
recIt.previous();
}
if (recIt.hasPrevious()) {
Record rec = recIt.previous();
DBRecord rec = recIt.previous();
Instruction prevInst = getInstructionDB(rec);
if (prevInst.getMaxAddress().compareTo(firstInstrStart) >= 0) {
return prevInst;
@ -275,12 +275,12 @@ public class CodeManager implements ErrorHandler, ManagerDB {
Data data = null;
recIt = dataAdapter.getRecords(firstInstrStart, true);
if (recIt.hasNext()) {
Record rec = recIt.next();
DBRecord rec = recIt.next();
data = getDataDB(rec);
recIt.previous();
}
if (recIt.hasPrevious()) {
Record rec = recIt.previous();
DBRecord rec = recIt.previous();
Data prevData = getDataDB(rec);
if (prevData.getMaxAddress().compareTo(firstInstrStart) >= 0) {
return prevData;
@ -930,8 +930,8 @@ public class CodeManager implements ErrorHandler, ManagerDB {
}
private CodeUnit getDefinedBefore(Address address) throws IOException {
Record dataRec = dataAdapter.getRecordBefore(address);
Record instRec = instAdapter.getRecordBefore(address);
DBRecord dataRec = dataAdapter.getRecordBefore(address);
DBRecord instRec = instAdapter.getRecordBefore(address);
if (dataRec == null && instRec == null) {
return null;
@ -1010,8 +1010,8 @@ public class CodeManager implements ErrorHandler, ManagerDB {
return cu;
}
try {
Record dataRec = dataAdapter.getRecordBefore(address);
Record instRec = instAdapter.getRecordBefore(address);
DBRecord dataRec = dataAdapter.getRecordBefore(address);
DBRecord instRec = instAdapter.getRecordBefore(address);
CodeUnit cuFirst = null, cuSecond = null;
@ -1320,7 +1320,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
try {
CodeUnit cu = cache.get(addr);
if (cu == null) {
Record rec = dataAdapter.getRecord(addr);
DBRecord rec = dataAdapter.getRecord(addr);
return getDataDB(rec);
}
else if (cu instanceof Data) {
@ -1350,7 +1350,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
public Instruction getInstructionBefore(Address addr) {
lock.acquire();
try {
Record rec = instAdapter.getRecordBefore(addr);
DBRecord rec = instAdapter.getRecordBefore(addr);
return getInstructionDB(rec);
}
catch (IOException e) {
@ -1374,7 +1374,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
public Instruction getInstructionAfter(Address addr) {
lock.acquire();
try {
Record rec = instAdapter.getRecordAfter(addr);
DBRecord rec = instAdapter.getRecordAfter(addr);
return getInstructionDB(rec);
}
catch (IOException e) {
@ -1548,7 +1548,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
public Data getDefinedDataAfter(Address addr) {
lock.acquire();
try {
Record rec = dataAdapter.getRecordAfter(addr);
DBRecord rec = dataAdapter.getRecordAfter(addr);
return getDataDB(rec);
}
catch (IOException e) {
@ -1573,7 +1573,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
public Data getDefinedDataBefore(Address addr) {
lock.acquire();
try {
Record rec = dataAdapter.getRecordBefore(addr);
DBRecord rec = dataAdapter.getRecordBefore(addr);
return getDataDB(rec);
}
catch (IOException e) {
@ -1682,7 +1682,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
while (true) {
if (nextInstAddr == null && instIter.hasNext()) {
Record nextInstRec = instIter.next();
DBRecord nextInstRec = instIter.next();
nextInstAddr = addrMap.decodeAddress(nextInstRec.getKey());
nextInstEndAddr = nextInstAddr;
int protoID = nextInstRec.getIntValue(InstDBAdapter.PROTO_ID_COL);
@ -1700,7 +1700,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
}
if (nextDataAddr == null && dataIter.hasNext()) {
Record nextDataRec = dataIter.next();
DBRecord nextDataRec = dataIter.next();
nextDataAddr = addrMap.decodeAddress(nextDataRec.getKey());
nextDataEndAddr = nextDataAddr;
DataDB data = getDataDB(nextDataRec);
@ -1919,7 +1919,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
RecordIterator recIt = instAdapter.getRecords(startAddr, true);
if (recIt.hasNext()) {
Record rec = recIt.next();
DBRecord rec = recIt.next();
Instruction inst = getInstructionDB(rec);
if (inst.getMinAddress().compareTo(endAddr) <= 0) {
throw new CodeUnitInsertionException("Conflicting instruction exists at address " +
@ -1928,7 +1928,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
recIt.previous();
}
if (recIt.hasPrevious()) {
Record rec = recIt.previous();
DBRecord rec = recIt.previous();
Instruction inst = getInstructionDB(rec);
if (inst.getMaxAddress().compareTo(startAddr) >= 0) {
throw new CodeUnitInsertionException("Conflicting instruction exists at address " +
@ -1938,7 +1938,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
recIt = dataAdapter.getRecords(startAddr, true);
if (recIt.hasNext()) {
Record rec = recIt.next();
DBRecord rec = recIt.next();
Data data = getDataDB(rec);
if (data.getMinAddress().compareTo(endAddr) <= 0) {
throw new CodeUnitInsertionException("Conflicting data exists at address " +
@ -1947,7 +1947,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
recIt.previous();
}
if (recIt.hasPrevious()) {
Record rec = recIt.previous();
DBRecord rec = recIt.previous();
Data data = getDataDB(rec);
if (data.getMaxAddress().compareTo(startAddr) >= 0) {
throw new CodeUnitInsertionException("Conflicting data exists at address " +
@ -2033,7 +2033,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
return getUndefinedDataDB(addr, addrMap.getKey(addr, false));
}
Record record = dataAdapter.createData(addr, dataManager.getResolvedID(dataType));
DBRecord record = dataAdapter.createData(addr, dataManager.getResolvedID(dataType));
DataType baseDt = dataType;
if (baseDt instanceof TypeDef) {
@ -2635,7 +2635,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
protected boolean isUndefined(Address address, long addr) {
if (program.getMemory().contains(address)) {
try {
Record rec = dataAdapter.getRecord(addr);
DBRecord rec = dataAdapter.getRecord(addr);
if (rec == null) {
rec = instAdapter.getRecord(addr);
}
@ -2668,7 +2668,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
RecordIterator it = dataAdapter.getRecords();
while (it.hasNext()) {
monitor.checkCanceled();
Record rec = it.next();
DBRecord rec = it.next();
long id = rec.getLongValue(DataDBAdapter.DATA_TYPE_ID_COL);
for (long dataTypeID : dataTypeIDs) {
if (id == dataTypeID) {
@ -2726,7 +2726,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
* the cache, create a new DB object and add it.
* @param rec record for the instruction
*/
InstructionDB getInstructionDB(Record rec) {
InstructionDB getInstructionDB(DBRecord rec) {
lock.acquire();
try {
if (rec != null) {
@ -2754,7 +2754,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
* create a new DB object and add it.
* @param rec data record
*/
DataDB getDataDB(Record rec) {
DataDB getDataDB(DBRecord rec) {
lock.acquire();
try {
if (rec != null) {
@ -2792,8 +2792,8 @@ public class CodeManager implements ErrorHandler, ManagerDB {
}
Address getDefinedAddressAfter(Address address) {
Record dataRec = null;
Record instRec = null;
DBRecord dataRec = null;
DBRecord instRec = null;
try {
dataRec = dataAdapter.getRecordAfter(address);
instRec = instAdapter.getRecordAfter(address);
@ -2876,7 +2876,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
RecordIterator iter = dataAdapter.getRecords(start, end, true);
while (iter.hasNext()) {
monitor.checkCanceled();
Record rec = iter.next();
DBRecord rec = iter.next();
Data data = getDataDB(rec);
addDataReferences(data, new ArrayList<Address>());
}
@ -3091,11 +3091,11 @@ public class CodeManager implements ErrorHandler, ManagerDB {
}
private InstructionDB getInstructionDB(long addr) throws IOException {
Record rec = instAdapter.getRecord(addr);
DBRecord rec = instAdapter.getRecord(addr);
return getInstructionDB(rec);
}
protected Record getInstructionRecord(long addr) {
protected DBRecord getInstructionRecord(long addr) {
try {
return instAdapter.getRecord(addr);
}
@ -3115,7 +3115,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
return null;
}
DataType getDataType(Record dataRecord) {
DataType getDataType(DBRecord dataRecord) {
if (dataRecord != null) {
long datatypeID = dataRecord.getLongValue(DataDBAdapter.DATA_TYPE_ID_COL);
DataType dt = dataManager.getDataType(datatypeID);
@ -3323,7 +3323,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
public String getComment(int commentType, Address address) {
try {
long addr = addrMap.getKey(address, false);
Record commentRec = getCommentAdapter().getRecord(addr);
DBRecord commentRec = getCommentAdapter().getRecord(addr);
if (commentRec != null) {
return commentRec.getString(commentType);
}
@ -3353,7 +3353,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
lock.acquire();
try {
long addr = addrMap.getKey(address, true);
Record commentRec = getCommentAdapter().getRecord(addr);
DBRecord commentRec = getCommentAdapter().getRecord(addr);
if (commentRec == null) {
if (comment == null) {
return;
@ -3444,20 +3444,20 @@ public class CodeManager implements ErrorHandler, ManagerDB {
try {
// records are sorted by date ascending
List<Record> allRecords = getHistoryRecords(addr, commentType);
List<DBRecord> allRecords = getHistoryRecords(addr, commentType);
List<CommentHistory> results = new ArrayList<>();
String comment = getComment(addr, commentType);
while (!allRecords.isEmpty()) {
Record rec = allRecords.get(allRecords.size() - 1);
DBRecord rec = allRecords.get(allRecords.size() - 1);
long date = rec.getLongValue(CommentHistoryAdapter.HISTORY_DATE_COL);
List<Record> records = subListByDate(allRecords, date);
List<DBRecord> records = subListByDate(allRecords, date);
List<StringDiff> diffs = new ArrayList<>(records.size());
String user = null;
for (Record r : records) {
for (DBRecord r : records) {
user = r.getString(CommentHistoryAdapter.HISTORY_USER_COL);
int pos1 = r.getIntValue(CommentHistoryAdapter.HISTORY_POS1_COL);
int pos2 = r.getIntValue(CommentHistoryAdapter.HISTORY_POS2_COL);
@ -3484,11 +3484,11 @@ public class CodeManager implements ErrorHandler, ManagerDB {
}
// note: you must have the lock when calling this method
private List<Record> getHistoryRecords(Address addr, int commentType) throws IOException {
private List<DBRecord> getHistoryRecords(Address addr, int commentType) throws IOException {
RecordIterator it = historyAdapter.getRecordsByAddress(addr);
List<Record> list = new ArrayList<>();
List<DBRecord> list = new ArrayList<>();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
if (rec.getByteValue(CommentHistoryAdapter.HISTORY_TYPE_COL) == commentType) {
list.add(rec);
}
@ -3497,10 +3497,10 @@ public class CodeManager implements ErrorHandler, ManagerDB {
}
// note: records are sorted by date; assume that the date we seek is at the end
private List<Record> subListByDate(List<Record> records, long date) {
private List<DBRecord> subListByDate(List<DBRecord> records, long date) {
for (int i = records.size() - 1; i >= 0; i--) {
Record rec = records.get(i);
DBRecord rec = records.get(i);
if (date != rec.getLongValue(CommentHistoryAdapter.HISTORY_DATE_COL)) {
return records.subList(i + 1, records.size());
}
@ -3511,7 +3511,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
}
private String getComment(Address addr, int commentType) throws IOException {
Record record = commentAdapter.getRecord(addrMap.getKey(addr, false));
DBRecord record = commentAdapter.getRecord(addrMap.getKey(addr, false));
if (record != null) {
return record.getString(commentType);
}
@ -3523,7 +3523,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
try {
RecordIterator it = dataAdapter.getRecords();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
long id = rec.getLongValue(DataDBAdapter.DATA_TYPE_ID_COL);
if (id == oldDataTypeID) {
rec.setLongValue(DataDBAdapter.DATA_TYPE_ID_COL, newDataTypeID);
@ -3551,7 +3551,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
private void addCommentHistoryRecords(Address start, Address end) throws IOException {
RecordIterator iter = commentAdapter.getRecords(start, end, true);
while (iter.hasNext()) {
Record rec = iter.next();
DBRecord rec = iter.next();
addCommentHistoryRecord(rec, CodeUnit.PRE_COMMENT);
addCommentHistoryRecord(rec, CodeUnit.POST_COMMENT);
addCommentHistoryRecord(rec, CodeUnit.EOL_COMMENT);
@ -3560,7 +3560,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
}
}
private void addCommentHistoryRecord(Record commentRec, int commentType) {
private void addCommentHistoryRecord(DBRecord commentRec, int commentType) {
String comment = commentRec.getString(commentType);
if (comment != null) {
createCommentHistoryRecord(addrMap.decodeAddress(commentRec.getKey()), commentType,
@ -3608,7 +3608,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
int count = 0;
RecordIterator recIter = instAdapter.getRecords();
while (recIter.hasNext()) {
Record rec = recIter.next();
DBRecord rec = recIter.next();
Address addr = addrMap.decodeAddress(rec.getKey());
if (minAddr == null) {

View file

@ -21,7 +21,7 @@ import java.util.*;
import org.apache.commons.lang3.StringUtils;
import db.Record;
import db.DBRecord;
import ghidra.program.database.*;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressOutOfBoundsException;
@ -53,7 +53,7 @@ abstract class CodeUnitDB extends DatabaseObject implements CodeUnit, ProcessorC
protected ReferenceManager refMgr;
protected ProgramDB program;
private Record commentRec;
private DBRecord commentRec;
private boolean checkedComments;
protected byte[] bytes;
private ProgramContext programContext;
@ -89,7 +89,7 @@ abstract class CodeUnitDB extends DatabaseObject implements CodeUnit, ProcessorC
}
@Override
protected boolean refresh(Record record) {
protected boolean refresh(DBRecord record) {
address = codeMgr.getAddressMap().decodeAddress(addr);
endAddr = null;
commentRec = null;
@ -121,7 +121,7 @@ abstract class CodeUnitDB extends DatabaseObject implements CodeUnit, ProcessorC
* does NOT indicate existence and a record query may be required.
* @return true if removal of code unit has been confirmed
*/
abstract protected boolean hasBeenDeleted(Record record);
abstract protected boolean hasBeenDeleted(DBRecord record);
@Override
public void addMnemonicReference(Address refAddr, RefType refType, SourceType sourceType) {
@ -794,7 +794,7 @@ abstract class CodeUnitDB extends DatabaseObject implements CodeUnit, ProcessorC
@Override
public abstract String toString();
Record getCommentRecord() {
DBRecord getCommentRecord() {
return commentRec;
}

View file

@ -102,7 +102,7 @@ abstract class CommentHistoryAdapter {
RecordIterator iter = oldAdapter.getAllRecords();
while (iter.hasNext()) {
monitor.checkCanceled();
Record rec = iter.next();
DBRecord rec = iter.next();
Address addr = oldAddrMap.decodeAddress(rec.getLongValue(HISTORY_ADDRESS_COL));
rec.setLongValue(HISTORY_ADDRESS_COL, addrMap.getKey(addr, true));
tmpAdapter.updateRecord(rec);
@ -115,7 +115,7 @@ abstract class CommentHistoryAdapter {
iter = tmpAdapter.getAllRecords();
while (iter.hasNext()) {
monitor.checkCanceled();
Record rec = iter.next();
DBRecord rec = iter.next();
newAdapter.updateRecord(rec);
monitor.setProgress(++count);
}
@ -150,7 +150,7 @@ abstract class CommentHistoryAdapter {
* @param rec the record to update
* @throws IOException if there was a problem accessing the database
*/
abstract void updateRecord(Record rec) throws IOException;
abstract void updateRecord(DBRecord rec) throws IOException;
/**
* Delete the records in the given range.

View file

@ -17,7 +17,7 @@ package ghidra.program.database.code;
import java.io.IOException;
import db.Record;
import db.DBRecord;
import db.RecordIterator;
import ghidra.program.database.util.EmptyRecordIterator;
import ghidra.program.model.address.Address;
@ -45,7 +45,7 @@ class CommentHistoryAdapterNoTable extends CommentHistoryAdapter {
}
@Override
void updateRecord(Record rec) throws IOException {
void updateRecord(DBRecord rec) throws IOException {
throw new UnsupportedOperationException();
}

View file

@ -63,7 +63,7 @@ class CommentHistoryAdapterV0 extends CommentHistoryAdapter {
void createRecord(long addr, byte commentType, int pos1, int pos2, String data, long date)
throws IOException {
Record rec = table.getSchema().createRecord(table.getKey());
DBRecord rec = table.getSchema().createRecord(table.getKey());
rec.setLongValue(HISTORY_ADDRESS_COL, addr);
rec.setByteValue(HISTORY_TYPE_COL, commentType);
rec.setIntValue(HISTORY_POS1_COL, pos1);
@ -87,7 +87,7 @@ class CommentHistoryAdapterV0 extends CommentHistoryAdapter {
}
@Override
void updateRecord(Record rec) throws IOException {
void updateRecord(DBRecord rec) throws IOException {
table.putRecord(rec);
}

View file

@ -127,7 +127,7 @@ abstract class CommentsDBAdapter {
RecordIterator iter = oldAdapter.getRecords();
while (iter.hasNext()) {
monitor.checkCanceled();
Record rec = iter.next();
DBRecord rec = iter.next();
Address addr = oldAddrMap.decodeAddress(rec.getKey());
rec.setKey(addrMap.getKey(addr, true));
tmpAdapter.updateRecord(rec);
@ -140,7 +140,7 @@ abstract class CommentsDBAdapter {
iter = tmpAdapter.getRecords();
while (iter.hasNext()) {
monitor.checkCanceled();
Record rec = iter.next();
DBRecord rec = iter.next();
newAdapter.updateRecord(rec);
monitor.setProgress(++count);
}
@ -161,7 +161,7 @@ abstract class CommentsDBAdapter {
* @param addr key for the record
* @throws IOException if there was a problem accessing the database
*/
abstract Record getRecord(long addr) throws IOException;
abstract DBRecord getRecord(long addr) throws IOException;
/**
* Create a comment record for the given comment type/
@ -171,7 +171,7 @@ abstract class CommentsDBAdapter {
* @return new comment record
* @throws IOException if there was a problem accessing the database
*/
abstract Record createRecord(long addr, int commentCol, String comment) throws IOException;
abstract DBRecord createRecord(long addr, int commentCol, String comment) throws IOException;
/**
* Delete the record at the given address
@ -194,7 +194,7 @@ abstract class CommentsDBAdapter {
* Update the record with the comments from the given record.
* @throws IOException if there was a problem accessing the database
*/
abstract void updateRecord(Record commentRec) throws IOException;
abstract void updateRecord(DBRecord commentRec) throws IOException;
/**
* @see ghidra.program.database.code.MoveRangeAdapter#getRecords(long, long, boolean)
@ -224,7 +224,7 @@ abstract class CommentsDBAdapter {
* @param record the record to put.
* @throws IOException if a database io error occurs
*/
abstract void putRecord(Record record) throws IOException;
abstract void putRecord(DBRecord record) throws IOException;
/**
* Returns a record iterator starting with the record at addr

View file

@ -79,7 +79,7 @@ class CommentsDBAdapterV0 extends CommentsDBAdapter {
* @see ghidra.program.database.code.CommentsDBAdapter#getRecord(long)
*/
@Override
public Record getRecord(long addr) throws IOException {
public DBRecord getRecord(long addr) throws IOException {
return adaptRecord(commentTable.getRecord(addr));
}
@ -87,7 +87,7 @@ class CommentsDBAdapterV0 extends CommentsDBAdapter {
* @see ghidra.program.database.code.CommentsDBAdapter#createRecord(long, int, java.lang.String)
*/
@Override
public Record createRecord(long addr, int commentCol, String comment) throws IOException {
public DBRecord createRecord(long addr, int commentCol, String comment) throws IOException {
return null;
}
@ -108,10 +108,10 @@ class CommentsDBAdapterV0 extends CommentsDBAdapter {
}
/**
* @see ghidra.program.database.code.CommentsDBAdapter#updateRecord(ghidra.framework.store.db.Record)
* @see ghidra.program.database.code.CommentsDBAdapter#updateRecord(ghidra.framework.store.db.DBRecord)
*/
@Override
public void updateRecord(Record commentRec) throws IOException {
public void updateRecord(DBRecord commentRec) throws IOException {
}
/**
@ -172,10 +172,10 @@ class CommentsDBAdapterV0 extends CommentsDBAdapter {
}
/**
* @see ghidra.program.database.code.CommentsDBAdapter#putRecord(db.Record)
* @see ghidra.program.database.code.CommentsDBAdapter#putRecord(db.DBRecord)
*/
@Override
public void putRecord(Record record) throws IOException {
public void putRecord(DBRecord record) throws IOException {
}
/**
@ -200,10 +200,10 @@ class CommentsDBAdapterV0 extends CommentsDBAdapter {
* @param recV0 the record matching the version 0 schema.
* @return a current comment record.
*/
private Record adaptRecord(Record recV0) {
private DBRecord adaptRecord(DBRecord recV0) {
if (recV0 == null)
return null;
Record record = COMMENTS_SCHEMA.createRecord(recV0.getKey());
DBRecord record = COMMENTS_SCHEMA.createRecord(recV0.getKey());
String comment = recV0.getString(EOL_COMMENT_COLUMN);
if (comment != null) {
@ -259,16 +259,16 @@ class CommentsDBAdapterV0 extends CommentsDBAdapter {
/**
* @see ghidra.framework.store.db.RecordIterator#next()
*/
public Record next() throws IOException {
Record rec = it.next();
public DBRecord next() throws IOException {
DBRecord rec = it.next();
return adaptRecord(rec);
}
/**
* @see ghidra.framework.store.db.RecordIterator#previous()
*/
public Record previous() throws IOException {
Record rec = it.previous();
public DBRecord previous() throws IOException {
DBRecord rec = it.previous();
return adaptRecord(rec);
}

View file

@ -86,13 +86,13 @@ class CommentsDBAdapterV1 extends CommentsDBAdapter {
}
@Override
Record getRecord(long addr) throws IOException {
DBRecord getRecord(long addr) throws IOException {
return commentTable.getRecord(addr);
}
@Override
Record createRecord(long addr, int commentCol, String comment) throws IOException {
Record record = COMMENTS_SCHEMA.createRecord(addr);
DBRecord createRecord(long addr, int commentCol, String comment) throws IOException {
DBRecord record = COMMENTS_SCHEMA.createRecord(addr);
record.setString(commentCol, comment);
commentTable.putRecord(record);
return record;
@ -109,7 +109,7 @@ class CommentsDBAdapterV1 extends CommentsDBAdapter {
}
@Override
void updateRecord(Record commentRec) throws IOException {
void updateRecord(DBRecord commentRec) throws IOException {
commentTable.putRecord(commentRec);
}
@ -148,7 +148,7 @@ class CommentsDBAdapterV1 extends CommentsDBAdapter {
}
@Override
void putRecord(Record record) throws IOException {
void putRecord(DBRecord record) throws IOException {
commentTable.putRecord(record);
}

View file

@ -18,7 +18,7 @@
*/
package ghidra.program.database.code;
import db.Record;
import db.DBRecord;
import ghidra.program.database.DBObjectCache;
import ghidra.program.model.address.Address;
import ghidra.program.model.data.*;
@ -87,7 +87,7 @@ class DataComponent extends DataDB {
}
@Override
protected boolean hasBeenDeleted(Record rec) {
protected boolean hasBeenDeleted(DBRecord rec) {
// Records do not apply to data components which
// are derived from parent data type
if (parent.hasBeenDeleted(null)) {

View file

@ -18,7 +18,7 @@ package ghidra.program.database.code;
import java.util.ArrayList;
import java.util.List;
import db.Record;
import db.DBRecord;
import ghidra.docking.settings.Settings;
import ghidra.docking.settings.SettingsDefinition;
import ghidra.program.database.DBObjectCache;
@ -87,7 +87,7 @@ class DataDB extends CodeUnitDB implements Data {
}
@Override
protected boolean refresh(Record record) {
protected boolean refresh(DBRecord record) {
if (componentCache != null) {
componentCache.invalidate();
}
@ -96,7 +96,7 @@ class DataDB extends CodeUnitDB implements Data {
}
@Override
protected boolean hasBeenDeleted(Record rec) {
protected boolean hasBeenDeleted(DBRecord rec) {
if (dataType == DataType.DEFAULT) {
return rec != null || !codeMgr.isUndefined(address, addr);
}

View file

@ -90,7 +90,7 @@ abstract class DataDBAdapter {
RecordIterator iter = oldAdapter.getRecords();
while (iter.hasNext()) {
monitor.checkCanceled();
Record rec = iter.next();
DBRecord rec = iter.next();
Address addr = oldAddrMap.decodeAddress(rec.getKey());
rec.setKey(addrMap.getKey(addr, true));
tmpAdapter.putRecord(rec);
@ -103,7 +103,7 @@ abstract class DataDBAdapter {
iter = tmpAdapter.getRecords();
while (iter.hasNext()) {
monitor.checkCanceled();
Record rec = iter.next();
DBRecord rec = iter.next();
newAdapter.putRecord(rec);
monitor.setProgress(++count);
}
@ -118,31 +118,31 @@ abstract class DataDBAdapter {
* Get the record at or after the given start address.
* @throws IOException if there was a problem accessing the database
*/
abstract Record getRecordAtOrAfter(Address start) throws IOException;
abstract DBRecord getRecordAtOrAfter(Address start) throws IOException;
/**
* Get the Record afer the given start address.
* @throws IOException if there was a problem accessing the database
*/
abstract Record getRecordAfter(Address start) throws IOException;
abstract DBRecord getRecordAfter(Address start) throws IOException;
/**
* Get the record at the given start address.
* @throws IOException if there was a problem accessing the database
*/
abstract Record getRecord(Address start) throws IOException;
abstract DBRecord getRecord(Address start) throws IOException;
/**
* Get the record at the give key;
* @param key the key of the record to retrieve.
*/
abstract Record getRecord(long key) throws IOException;
abstract DBRecord getRecord(long key) throws IOException;
/**
* Get the record before the given address address.
* @throws IOException if there was a problem accessing the database
*/
abstract Record getRecordBefore(Address addr) throws IOException;
abstract DBRecord getRecordBefore(Address addr) throws IOException;
/**
* Get a record iterator starting at the given address address.
@ -169,7 +169,7 @@ abstract class DataDBAdapter {
* @param dataTypeID ID of data type
* @throws IOException if there was a problem accessing the database
*/
abstract Record createData(Address addr, long dataTypeID) throws IOException;
abstract DBRecord createData(Address addr, long dataTypeID) throws IOException;
/**
* Get the number of records in the data table.
@ -183,7 +183,7 @@ abstract class DataDBAdapter {
* @throws IOException if there was a problem accessing the database
* @return
*/
abstract Record getRecordAtOrBefore(Address addr) throws IOException;
abstract DBRecord getRecordAtOrBefore(Address addr) throws IOException;
/**
* Get a iterator over the keys in the data table.
@ -216,7 +216,7 @@ abstract class DataDBAdapter {
* @param record the record to add or update.
* @throws IOException if a database io error occurs.
*/
abstract void putRecord(Record record) throws IOException;
abstract void putRecord(DBRecord record) throws IOException;
/**
* Returns an iterator over the keys that fall within the address set provided.

View file

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -62,7 +61,7 @@ class DataDBAdapterV0 extends DataDBAdapter {
* @see ghidra.program.database.code.DataDBAdapter#getRecordAtOrAfter(ghidra.program.model.address.Address)
*/
@Override
Record getRecordAtOrAfter(Address addr) throws IOException {
DBRecord getRecordAtOrAfter(Address addr) throws IOException {
AddressKeyRecordIterator it = new AddressKeyRecordIterator(dataTable, addrMap, addr, true);
return it.next();
}
@ -71,7 +70,7 @@ class DataDBAdapterV0 extends DataDBAdapter {
* @see ghidra.program.database.code.DataDBAdapter#getRecordAtOrBefore(long)
*/
@Override
Record getRecordAtOrBefore(Address addr) throws IOException {
DBRecord getRecordAtOrBefore(Address addr) throws IOException {
AddressKeyRecordIterator it = new AddressKeyRecordIterator(dataTable, addrMap, addr, false);
return it.previous();
}
@ -80,7 +79,7 @@ class DataDBAdapterV0 extends DataDBAdapter {
* @see ghidra.program.database.code.DataDBAdapter#getRecordAfter(long)
*/
@Override
Record getRecordAfter(Address addr) throws IOException {
DBRecord getRecordAfter(Address addr) throws IOException {
AddressKeyRecordIterator it = new AddressKeyRecordIterator(dataTable, addrMap, addr, false);
return it.next();
}
@ -89,7 +88,7 @@ class DataDBAdapterV0 extends DataDBAdapter {
* @see ghidra.program.database.code.DataDBAdapter#getRecord(long)
*/
@Override
Record getRecord(Address addr) throws IOException {
DBRecord getRecord(Address addr) throws IOException {
return dataTable.getRecord(addrMap.getKey(addr, false));
}
@ -97,7 +96,7 @@ class DataDBAdapterV0 extends DataDBAdapter {
* @see ghidra.program.database.code.DataDBAdapter#getRecord(long)
*/
@Override
Record getRecord(long key) throws IOException {
DBRecord getRecord(long key) throws IOException {
return dataTable.getRecord(key);
}
@ -105,7 +104,7 @@ class DataDBAdapterV0 extends DataDBAdapter {
* @see ghidra.program.database.code.DataDBAdapter#getRecordBefore(long)
*/
@Override
Record getRecordBefore(Address addr) throws IOException {
DBRecord getRecordBefore(Address addr) throws IOException {
AddressKeyRecordIterator it = new AddressKeyRecordIterator(dataTable, addrMap, addr, true);
return it.previous();
}
@ -151,9 +150,9 @@ class DataDBAdapterV0 extends DataDBAdapter {
* @see ghidra.program.database.code.DataDBAdapter#createData(long, long)
*/
@Override
Record createData(Address newAddr, long dataTypeID) throws IOException {
DBRecord createData(Address newAddr, long dataTypeID) throws IOException {
long key = addrMap.getKey(newAddr, true);
Record record = DATA_SCHEMA.createRecord(key);
DBRecord record = DATA_SCHEMA.createRecord(key);
record.setLongValue(DATA_TYPE_ID_COL, dataTypeID);
dataTable.putRecord(record);
return record;
@ -198,10 +197,10 @@ class DataDBAdapterV0 extends DataDBAdapter {
}
/**
* @see ghidra.program.database.code.MoveRangeAdapter#putRecord(ghidra.framework.store.db.Record)
* @see ghidra.program.database.code.MoveRangeAdapter#putRecord(ghidra.framework.store.db.DBRecord)
*/
@Override
void putRecord(Record record) throws IOException {
void putRecord(DBRecord record) throws IOException {
dataTable.putRecord(record);
}

View file

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -21,7 +20,7 @@ import ghidra.program.model.listing.DataIterator;
import java.io.IOException;
import db.Record;
import db.DBRecord;
import db.RecordIterator;
/**
@ -78,7 +77,7 @@ public class DataRecordIterator implements DataIterator {
private void findNext() {
try {
while (nextData == null && (forward ? it.hasNext() : it.hasPrevious())) {
Record record = forward ? it.next() : it.previous();
DBRecord record = forward ? it.next() : it.previous();
nextData = codeMgr.getDataDB(record);
}
}

View file

@ -95,7 +95,7 @@ abstract class InstDBAdapter {
RecordIterator iter = oldAdapter.getRecords();
while (iter.hasNext()) {
monitor.checkCanceled();
Record rec = iter.next();
DBRecord rec = iter.next();
Address addr = oldAddrMap.decodeAddress(rec.getKey());
rec.setKey(addrMap.getKey(addr, true));
tmpAdapter.putRecord(rec);
@ -108,7 +108,7 @@ abstract class InstDBAdapter {
iter = tmpAdapter.getRecords();
while (iter.hasNext()) {
monitor.checkCanceled();
Record rec = iter.next();
DBRecord rec = iter.next();
newAdapter.putRecord(rec);
monitor.setProgress(++count);
}
@ -148,7 +148,7 @@ abstract class InstDBAdapter {
* @return the next record or null.
* @throws IOException if there was a problem accessing the database
*/
abstract Record getRecordAtOrAfter(Address addr) throws IOException;
abstract DBRecord getRecordAtOrAfter(Address addr) throws IOException;
/**
* Returns the next record after the given address key
@ -156,21 +156,21 @@ abstract class InstDBAdapter {
* @return the next record or null.
* @throws IOException if there was a problem accessing the database
*/
abstract Record getRecordAfter(Address addr) throws IOException;
abstract DBRecord getRecordAfter(Address addr) throws IOException;
/**
* Returns the record at the given key or null if none exists.
* @param addr the key.
* @throws IOException if there was a problem accessing the database
*/
abstract Record getRecord(long addr) throws IOException;
abstract DBRecord getRecord(long addr) throws IOException;
/**
* Returns the record at the given address or null if none exists.
* @param addr the address to use as the key
* @throws IOException if there was a problem accessing the database
*/
abstract Record getRecord(Address addr) throws IOException;
abstract DBRecord getRecord(Address addr) throws IOException;
/**
* Returns the record just before the given address key.
@ -178,7 +178,7 @@ abstract class InstDBAdapter {
* @return the previous record or null.
* @throws IOException if there was a problem accessing the database
*/
abstract Record getRecordBefore(Address addr) throws IOException;
abstract DBRecord getRecordBefore(Address addr) throws IOException;
/**
* Returns a record iterator over all records in the given range.
@ -207,7 +207,7 @@ abstract class InstDBAdapter {
* @return the previous record or null.
* @throws IOException if there was a problem accessing the database
*/
abstract Record getRecordAtOrBefore(Address addr) throws IOException;
abstract DBRecord getRecordAtOrBefore(Address addr) throws IOException;
/**
* Returns an AddressKeyIterator over the given range.
@ -233,7 +233,7 @@ abstract class InstDBAdapter {
* @param record the record to add or update.
* @throws IOException if there was a problem accessing the database
*/
abstract void putRecord(Record record) throws IOException;
abstract void putRecord(DBRecord record) throws IOException;
/**
* Returns a record iterator starting at the given address.

View file

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -78,7 +77,7 @@ class InstDBAdapterV0 extends InstDBAdapter {
* @see ghidra.program.database.code.InstDBAdapter#getRecordAtOrAfter(long)
*/
@Override
Record getRecordAtOrAfter(Address start) throws IOException {
DBRecord getRecordAtOrAfter(Address start) throws IOException {
RecordIterator it = new AddressKeyRecordIterator(instTable, addrMap, start, true);
return adaptRecord(it.next());
}
@ -87,7 +86,7 @@ class InstDBAdapterV0 extends InstDBAdapter {
* @see ghidra.program.database.code.InstDBAdapter#getRecordAtOrBefore(long)
*/
@Override
Record getRecordAtOrBefore(Address addr) throws IOException {
DBRecord getRecordAtOrBefore(Address addr) throws IOException {
RecordIterator it = new AddressKeyRecordIterator(instTable, addrMap, addr, false);
return adaptRecord(it.previous());
}
@ -96,7 +95,7 @@ class InstDBAdapterV0 extends InstDBAdapter {
* @see ghidra.program.database.code.InstDBAdapter#getRecord(long)
*/
@Override
Record getRecord(Address addr) throws IOException {
DBRecord getRecord(Address addr) throws IOException {
return getRecord(addrMap.getKey(addr, false));
}
@ -104,7 +103,7 @@ class InstDBAdapterV0 extends InstDBAdapter {
* @see ghidra.program.database.code.InstDBAdapter#getRecord(long)
*/
@Override
Record getRecord(long addr) throws IOException {
DBRecord getRecord(long addr) throws IOException {
return adaptRecord(instTable.getRecord(addr));
}
@ -112,7 +111,7 @@ class InstDBAdapterV0 extends InstDBAdapter {
* @see ghidra.program.database.code.InstDBAdapter#getRecordAfter(long)
*/
@Override
Record getRecordAfter(Address addr) throws IOException {
DBRecord getRecordAfter(Address addr) throws IOException {
RecordIterator it = new AddressKeyRecordIterator(instTable, addrMap, addr, false);
return adaptRecord(it.next());
}
@ -121,7 +120,7 @@ class InstDBAdapterV0 extends InstDBAdapter {
* @see ghidra.program.database.code.InstDBAdapter#getRecordBefore(long)
*/
@Override
Record getRecordBefore(Address addr) throws IOException {
DBRecord getRecordBefore(Address addr) throws IOException {
RecordIterator it = new AddressKeyRecordIterator(instTable, addrMap, addr, true);
return adaptRecord(it.previous());
}
@ -183,10 +182,10 @@ class InstDBAdapterV0 extends InstDBAdapter {
}
/**
* @see ghidra.program.database.code.MoveRangeAdapter#putRecord(ghidra.framework.store.db.Record)
* @see ghidra.program.database.code.MoveRangeAdapter#putRecord(ghidra.framework.store.db.DBRecord)
*/
@Override
void putRecord(Record record) throws IOException {
void putRecord(DBRecord record) throws IOException {
throw new UnsupportedOperationException();
}
@ -207,10 +206,10 @@ class InstDBAdapterV0 extends InstDBAdapter {
forward ? set.getMinAddress() : set.getMaxAddress(), forward));
}
private Record adaptRecord(Record rec) {
private DBRecord adaptRecord(DBRecord rec) {
if (rec == null)
return null;
Record newRec = INSTRUCTION_SCHEMA.createRecord(rec.getKey());
DBRecord newRec = INSTRUCTION_SCHEMA.createRecord(rec.getKey());
newRec.setIntValue(0, rec.getIntValue(0));
newRec.setByteValue(1, (byte) 0);
return newRec;
@ -247,16 +246,16 @@ class InstDBAdapterV0 extends InstDBAdapter {
/**
* @see ghidra.framework.store.db.RecordIterator#next()
*/
public Record next() throws IOException {
Record rec = it.next();
public DBRecord next() throws IOException {
DBRecord rec = it.next();
return adaptRecord(rec);
}
/**
* @see ghidra.framework.store.db.RecordIterator#previous()
*/
public Record previous() throws IOException {
Record rec = it.previous();
public DBRecord previous() throws IOException {
DBRecord rec = it.previous();
return adaptRecord(rec);
}

View file

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -68,7 +67,7 @@ class InstDBAdapterV1 extends InstDBAdapter {
*/
@Override
void createInstruction(long addr, int protoID, byte flags) throws IOException {
Record record = INSTRUCTION_SCHEMA.createRecord(addr);
DBRecord record = INSTRUCTION_SCHEMA.createRecord(addr);
record.setIntValue(PROTO_ID_COL, protoID);
record.setByteValue(FLAGS_COL, flags);
instTable.putRecord(record);
@ -86,7 +85,7 @@ class InstDBAdapterV1 extends InstDBAdapter {
* @see ghidra.program.database.code.InstDBAdapter#getRecordAtOrAfter(long)
*/
@Override
Record getRecordAtOrAfter(Address addr) throws IOException {
DBRecord getRecordAtOrAfter(Address addr) throws IOException {
AddressKeyRecordIterator it = new AddressKeyRecordIterator(instTable, addrMap, addr, true);
return it.next();
}
@ -95,7 +94,7 @@ class InstDBAdapterV1 extends InstDBAdapter {
* @see ghidra.program.database.code.InstDBAdapter#getRecord(long)
*/
@Override
Record getRecord(long addr) throws IOException {
DBRecord getRecord(long addr) throws IOException {
return instTable.getRecord(addr);
}
@ -103,7 +102,7 @@ class InstDBAdapterV1 extends InstDBAdapter {
* @see ghidra.program.database.code.InstDBAdapter#getRecord(ghidra.program.model.address.Address)
*/
@Override
Record getRecord(Address addr) throws IOException {
DBRecord getRecord(Address addr) throws IOException {
return instTable.getRecord(addrMap.getKey(addr, false));
}
@ -111,7 +110,7 @@ class InstDBAdapterV1 extends InstDBAdapter {
* @see ghidra.program.database.code.InstDBAdapter#getRecordAfter(long)
*/
@Override
Record getRecordAfter(Address addr) throws IOException {
DBRecord getRecordAfter(Address addr) throws IOException {
AddressKeyRecordIterator it = new AddressKeyRecordIterator(instTable, addrMap, addr, false);
return it.next();
}
@ -120,7 +119,7 @@ class InstDBAdapterV1 extends InstDBAdapter {
* @see ghidra.program.database.code.InstDBAdapter#getRecordBefore(long)
*/
@Override
Record getRecordBefore(Address addr) throws IOException {
DBRecord getRecordBefore(Address addr) throws IOException {
AddressKeyRecordIterator it = new AddressKeyRecordIterator(instTable, addrMap, addr, true);
return it.previous();
}
@ -157,7 +156,7 @@ class InstDBAdapterV1 extends InstDBAdapter {
* @see ghidra.program.database.code.InstDBAdapter#getRecordAtOrBefore(long)
*/
@Override
Record getRecordAtOrBefore(Address addr) throws IOException {
DBRecord getRecordAtOrBefore(Address addr) throws IOException {
AddressKeyRecordIterator it = new AddressKeyRecordIterator(instTable, addrMap, addr, false);
return it.previous();
}
@ -201,10 +200,10 @@ class InstDBAdapterV1 extends InstDBAdapter {
}
/**
* @see ghidra.program.database.code.MoveRangeAdapter#putRecord(ghidra.framework.store.db.Record)
* @see ghidra.program.database.code.MoveRangeAdapter#putRecord(ghidra.framework.store.db.DBRecord)
*/
@Override
void putRecord(Record record) throws IOException {
void putRecord(DBRecord record) throws IOException {
instTable.putRecord(record);
}
@ -221,7 +220,7 @@ class InstDBAdapterV1 extends InstDBAdapter {
*/
@Override
void updateFlags(long addr, byte flags) throws IOException {
Record rec = instTable.getRecord(addr);
DBRecord rec = instTable.getRecord(addr);
rec.setByteValue(FLAGS_COL, flags);
instTable.putRecord(rec);
}

View file

@ -18,7 +18,7 @@ package ghidra.program.database.code;
import java.util.ArrayList;
import java.util.List;
import db.Record;
import db.DBRecord;
import ghidra.program.database.DBObjectCache;
import ghidra.program.model.address.*;
import ghidra.program.model.lang.*;
@ -71,7 +71,7 @@ public class InstructionDB extends CodeUnitDB implements Instruction, Instructio
}
@Override
protected boolean refresh(Record record) {
protected boolean refresh(DBRecord record) {
parserContext = null;
return super.refresh(record);
}
@ -83,7 +83,7 @@ public class InstructionDB extends CodeUnitDB implements Instruction, Instructio
}
@Override
protected boolean hasBeenDeleted(Record rec) {
protected boolean hasBeenDeleted(DBRecord rec) {
if (rec == null) {
rec = codeMgr.getInstructionRecord(addr);
if (rec == null) {

View file

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -22,7 +21,7 @@ import ghidra.program.model.listing.InstructionIterator;
import java.io.IOException;
import java.util.Iterator;
import db.Record;
import db.DBRecord;
import db.RecordIterator;
/**
@ -74,7 +73,7 @@ public class InstructionRecordIterator implements InstructionIterator {
private void findNext() {
try {
while (nextInstruction == null && (forward ? it.hasNext() : it.hasPrevious())) {
Record record = forward ? it.next() : it.previous();
DBRecord record = forward ? it.next() : it.previous();
nextInstruction = codeMgr.getInstructionDB(record);
}
}

View file

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,7 +17,7 @@ package ghidra.program.database.code;
import java.io.IOException;
import db.Record;
import db.DBRecord;
import db.RecordIterator;
/**
@ -31,7 +30,7 @@ interface ProtoDBAdapter {
* @param protoId
* @return
*/
Record getRecord(int protoId) throws IOException;
DBRecord getRecord(int protoId) throws IOException;
/**
* Returns a record iterator over all records.

View file

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -90,15 +89,15 @@ class ProtoDBAdapterV0 implements ProtoDBAdapter {
/**
* @see ghidra.program.database.code.ProtoDBAdapter#getRecord(int)
*/
public Record getRecord(int protoId) throws IOException {
public DBRecord getRecord(int protoId) throws IOException {
return convertRecord(table.getRecord(protoId));
}
private Record convertRecord(Record oldRec) {
private DBRecord convertRecord(DBRecord oldRec) {
long key = oldRec.getKey();
if (key < 0)
key = -key;
Record newRec = PrototypeManager.PROTO_SCHEMA.createRecord(key);
DBRecord newRec = PrototypeManager.PROTO_SCHEMA.createRecord(key);
newRec.setBinaryData(0, oldRec.getBinaryData(0));
newRec.setLongValue(1, oldRec.getLongValue(1));
newRec.setBooleanValue(2, false);
@ -131,16 +130,16 @@ class ProtoDBAdapterV0 implements ProtoDBAdapter {
return it.hasPrevious();
}
public Record next() throws IOException {
public DBRecord next() throws IOException {
return convertRecord(it.next());
}
public Record previous() throws IOException {
Record rec = it.previous();
public DBRecord previous() throws IOException {
DBRecord rec = it.previous();
long key = rec.getKey();
if (key < 0)
key = -key;
Record newRec = PrototypeManager.PROTO_SCHEMA.createRecord(key);
DBRecord newRec = PrototypeManager.PROTO_SCHEMA.createRecord(key);
newRec.setBinaryData(0, rec.getBinaryData(0));
newRec.setLongValue(1, rec.getLongValue(1));
newRec.setBooleanValue(2, false);

View file

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -66,7 +65,7 @@ class ProtoDBAdapterV1 implements ProtoDBAdapter {
public void createRecord(int protoID, long addr, byte[] b, boolean inDelaySlot)
throws IOException {
Record record = PrototypeManager.PROTO_SCHEMA.createRecord(protoID);
DBRecord record = PrototypeManager.PROTO_SCHEMA.createRecord(protoID);
record.setBinaryData(PrototypeManager.BYTES_COL, b);
record.setLongValue(PrototypeManager.ADDR_COL, addr);
record.setBooleanValue(2, inDelaySlot);
@ -83,7 +82,7 @@ class ProtoDBAdapterV1 implements ProtoDBAdapter {
/**
* @see ghidra.program.database.code.ProtoDBAdapter#getRecord(int)
*/
public Record getRecord(int protoId) throws IOException {
public DBRecord getRecord(int protoId) throws IOException {
return table.getRecord(protoId);
}

View file

@ -133,7 +133,7 @@ class PrototypeManager {
if (monitor.isCancelled()) {
throw new IOException("Upgrade Cancelled");
}
Record rec = it.next();
DBRecord rec = it.next();
String oldValue = rec.getString(0);
rec.setString(0, convertString(oldValue));
tempTable.putRecord(rec);
@ -147,7 +147,7 @@ class PrototypeManager {
if (monitor.isCancelled()) {
throw new IOException("Upgrade Cancelled");
}
Record rec = it.next();
DBRecord rec = it.next();
contextTable.putRecord(rec);
}
}
@ -192,7 +192,7 @@ class PrototypeManager {
if (monitor.isCancelled()) {
throw new IOException("Upgrade Cancelled");
}
Record rec = it.next();
DBRecord rec = it.next();
tempAdapter.createRecord((int) rec.getKey(), rec.getLongValue(ADDR_COL),
rec.getBinaryData(BYTES_COL), rec.getBooleanValue(DELAY_COL));
}
@ -207,7 +207,7 @@ class PrototypeManager {
if (monitor.isCancelled()) {
throw new IOException("Upgrade Cancelled");
}
Record rec = it.next();
DBRecord rec = it.next();
protoAdapter.createRecord((int) rec.getKey(), rec.getLongValue(ADDR_COL),
rec.getBinaryData(BYTES_COL), rec.getBooleanValue(DELAY_COL));
@ -279,7 +279,7 @@ class PrototypeManager {
String valueStr =
registerValue != null ? registerValue.getUnsignedValueIgnoreMask().toString()
: "0";
Record record = REGISTER_SCHEMA.createRecord(protoID);
DBRecord record = REGISTER_SCHEMA.createRecord(protoID);
record.setString(0, valueStr);
contextTable.putRecord(record);
}
@ -310,7 +310,7 @@ class PrototypeManager {
RecordIterator iter = protoAdapter.getRecords();
while (iter.hasNext()) {
Record record = iter.next();
DBRecord record = iter.next();
int protoID = (int) record.getKey();
@ -344,7 +344,7 @@ class PrototypeManager {
int getOriginalPrototypeLength(int protoId) {
try {
Record record = protoAdapter.getRecord(protoId);
DBRecord record = protoAdapter.getRecord(protoId);
if (record != null) {
byte[] bytes = record.getBinaryData(BYTES_COL);
return bytes.length;
@ -359,7 +359,7 @@ class PrototypeManager {
RegisterValue getOriginalPrototypeContext(InstructionPrototype prototype,
Register baseContextReg) throws NoValueException {
try {
Record record = contextTable.getRecord(protoHt.get(prototype));
DBRecord record = contextTable.getRecord(protoHt.get(prototype));
if (record != null) {
String s = record.getString(0);
BigInteger value = s != null ? new BigInteger(s) : BigInteger.ZERO;
@ -372,7 +372,7 @@ class PrototypeManager {
return null;
}
private InstructionPrototype createPrototype(long protoID, Record record) {
private InstructionPrototype createPrototype(long protoID, DBRecord record) {
Address address = addrMap.decodeAddress(record.getLongValue(ADDR_COL));
byte[] bytes = record.getBinaryData(BYTES_COL);
MemBuffer memBuffer = new ByteMemBufferImpl(address, bytes, language.isBigEndian());
@ -465,7 +465,7 @@ class PrototypeManager {
return null;
}
try {
Record record = contextTable.getRecord(protoID);
DBRecord record = contextTable.getRecord(protoID);
if (record != null) {
String s = record.getString(0);
BigInteger value = s != null ? new BigInteger(s) : BigInteger.ZERO;
@ -484,7 +484,7 @@ class PrototypeManager {
return null;
}
try {
Record record = contextTable.getRecord(protoID);
DBRecord record = contextTable.getRecord(protoID);
if (record != null) {
String s = record.getString(0);
BigInteger value = new BigInteger(s);

View file

@ -17,7 +17,7 @@ package ghidra.program.database.data;
import java.io.IOException;
import db.Record;
import db.DBRecord;
import ghidra.docking.settings.Settings;
import ghidra.docking.settings.SettingsDefinition;
import ghidra.program.database.DBObjectCache;
@ -45,7 +45,7 @@ class ArrayDB extends DataTypeDB implements Array {
* @param record
*/
public ArrayDB(DataTypeManagerDB dataMgr, DBObjectCache<DataTypeDB> cache,
ArrayDBAdapter adapter, Record record) {
ArrayDBAdapter adapter, DBRecord record) {
super(dataMgr, cache, record);
this.adapter = adapter;
}
@ -74,7 +74,7 @@ class ArrayDB extends DataTypeDB implements Array {
@Override
protected boolean refresh() {
try {
Record rec = adapter.getRecord(key);
DBRecord rec = adapter.getRecord(key);
if (rec != null) {
record = rec;
return super.refresh();

View file

@ -67,14 +67,14 @@ abstract class ArrayDBAdapter {
tmpAdapter = new ArrayDBAdapterV1(tmpHandle, true);
RecordIterator it = oldAdapter.getRecords();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
tmpAdapter.updateRecord(rec);
}
oldAdapter.deleteTable(handle);
ArrayDBAdapterV1 newAdapter = new ArrayDBAdapterV1(handle, true);
it = tmpAdapter.getRecords();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
newAdapter.updateRecord(rec);
}
return newAdapter;
@ -85,16 +85,16 @@ abstract class ArrayDBAdapter {
}
}
abstract Record createRecord(long dataTypeID, int numberOfElements, int length, long catID)
abstract DBRecord createRecord(long dataTypeID, int numberOfElements, int length, long catID)
throws IOException;
abstract Record getRecord(long arrayID) throws IOException;
abstract DBRecord getRecord(long arrayID) throws IOException;
abstract RecordIterator getRecords() throws IOException;
abstract boolean removeRecord(long dataID) throws IOException;
abstract void updateRecord(Record record) throws IOException;
abstract void updateRecord(DBRecord record) throws IOException;
abstract void deleteTable(DBHandle handle) throws IOException;

View file

@ -56,13 +56,13 @@ class ArrayDBAdapterV0 extends ArrayDBAdapter {
}
@Override
public Record createRecord(long dataTypeID, int numberOfElements, int length, long catID)
public DBRecord createRecord(long dataTypeID, int numberOfElements, int length, long catID)
throws IOException {
return null;
}
@Override
public Record getRecord(long arrayID) throws IOException {
public DBRecord getRecord(long arrayID) throws IOException {
return translateRecord(table.getRecord(arrayID));
}
@ -77,14 +77,14 @@ class ArrayDBAdapterV0 extends ArrayDBAdapter {
}
@Override
public void updateRecord(Record record) throws IOException {
public void updateRecord(DBRecord record) throws IOException {
}
private Record translateRecord(Record oldRec) {
private DBRecord translateRecord(DBRecord oldRec) {
if (oldRec == null) {
return null;
}
Record rec = ArrayDBAdapter.SCHEMA.createRecord(oldRec.getKey());
DBRecord rec = ArrayDBAdapter.SCHEMA.createRecord(oldRec.getKey());
rec.setLongValue(ArrayDBAdapter.ARRAY_DT_ID_COL, oldRec.getLongValue(V0_ARRAY_DT_ID_COL));
rec.setIntValue(ArrayDBAdapter.ARRAY_DIM_COL, oldRec.getIntValue(V0_ARRAY_DIM_COL));
rec.setIntValue(ArrayDBAdapter.ARRAY_LENGTH_COL, oldRec.getIntValue(V0_ARRAY_LENGTH_COL));
@ -115,14 +115,14 @@ class ArrayDBAdapterV0 extends ArrayDBAdapter {
}
@Override
public Record next() throws IOException {
Record rec = it.next();
public DBRecord next() throws IOException {
DBRecord rec = it.next();
return translateRecord(rec);
}
@Override
public Record previous() throws IOException {
Record rec = it.previous();
public DBRecord previous() throws IOException {
DBRecord rec = it.previous();
return translateRecord(rec);
}
}

View file

@ -64,7 +64,7 @@ class ArrayDBAdapterV1 extends ArrayDBAdapter {
}
@Override
public Record createRecord(long dataTypeID, int numberOfElements, int length, long catID)
public DBRecord createRecord(long dataTypeID, int numberOfElements, int length, long catID)
throws IOException {
long tableKey = table.getKey();
@ -73,7 +73,7 @@ class ArrayDBAdapterV1 extends ArrayDBAdapter {
// }
long key = DataTypeManagerDB.createKey(DataTypeManagerDB.ARRAY, tableKey);
Record record = V1_SCHEMA.createRecord(key);
DBRecord record = V1_SCHEMA.createRecord(key);
record.setLongValue(V1_ARRAY_DT_ID_COL, dataTypeID);
record.setIntValue(V1_ARRAY_DIM_COL, numberOfElements);
record.setIntValue(V1_ARRAY_LENGTH_COL, length);
@ -83,7 +83,7 @@ class ArrayDBAdapterV1 extends ArrayDBAdapter {
}
@Override
public Record getRecord(long arrayID) throws IOException {
public DBRecord getRecord(long arrayID) throws IOException {
return table.getRecord(arrayID);
}
@ -98,7 +98,7 @@ class ArrayDBAdapterV1 extends ArrayDBAdapter {
}
@Override
public void updateRecord(Record record) throws IOException {
public void updateRecord(DBRecord record) throws IOException {
table.putRecord(record);
}

View file

@ -53,7 +53,7 @@ public abstract class BuiltinDBAdapter {
* @return new record
* @throws IOException if there was a problem accessing the database
*/
abstract Record createRecord(String name, String className, long categoryID) throws IOException;
abstract DBRecord createRecord(String name, String className, long categoryID) throws IOException;
/**
* Gets the Built-in data type record with the indicated ID.
@ -61,7 +61,7 @@ public abstract class BuiltinDBAdapter {
* @return the record for the Built-in data type.
* @throws IOException if there was a problem accessing the database
*/
abstract Record getRecord(long dataTypeID) throws IOException;
abstract DBRecord getRecord(long dataTypeID) throws IOException;
/**
* Returns an array containing the data type IDs for the given category ID
@ -77,7 +77,7 @@ public abstract class BuiltinDBAdapter {
* @param record the new record
* @throws IOException if there was a problem accessing the database
*/
abstract void updateRecord(Record record) throws IOException;
abstract void updateRecord(DBRecord record) throws IOException;
/**
* Remove the record with the given dataID.

View file

@ -64,7 +64,7 @@ class BuiltinDBAdapterV0 extends BuiltinDBAdapter {
}
@Override
public Record getRecord(long dataTypeID) throws IOException {
public DBRecord getRecord(long dataTypeID) throws IOException {
return table.getRecord(dataTypeID);
}
@ -74,7 +74,7 @@ class BuiltinDBAdapterV0 extends BuiltinDBAdapter {
}
@Override
public void updateRecord(Record record) throws IOException {
public void updateRecord(DBRecord record) throws IOException {
table.putRecord(record);
}
@ -84,7 +84,7 @@ class BuiltinDBAdapterV0 extends BuiltinDBAdapter {
}
@Override
public Record createRecord(String name, String className, long categoryID) throws IOException {
public DBRecord createRecord(String name, String className, long categoryID) throws IOException {
long tableKey = table.getKey();
if (tableKey <= 100) {
@ -92,7 +92,7 @@ class BuiltinDBAdapterV0 extends BuiltinDBAdapter {
}
long key = DataTypeManagerDB.createKey(DataTypeManagerDB.BUILT_IN, tableKey);
Record record = V0_SCHEMA.createRecord(key);
DBRecord record = V0_SCHEMA.createRecord(key);
record.setString(V0_BUILT_IN_NAME_COL, name);
record.setString(V0_BUILT_IN_CLASSNAME_COL, className);
record.setLongValue(V0_BUILT_IN_CAT_COL, categoryID);

View file

@ -20,7 +20,7 @@ import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import db.Field;
import db.Record;
import db.DBRecord;
import ghidra.program.database.DBObjectCache;
import ghidra.program.database.DatabaseObject;
import ghidra.program.model.data.*;
@ -112,7 +112,7 @@ class CategoryDB extends DatabaseObject implements Category {
}
@Override
protected boolean refresh(Record rec) {
protected boolean refresh(DBRecord rec) {
subcategoryMap.clear();
dataTypeMap.clear();
conflictMap.clear();

View file

@ -39,7 +39,7 @@ abstract class CategoryDBAdapter {
* @return the record for the given ID or null if no record with that id exists.
* @throws IOException if IO error occurs
*/
abstract Record getRecord(long categoryID) throws IOException;
abstract DBRecord getRecord(long categoryID) throws IOException;
/**
* Updates the record in the database
@ -67,7 +67,7 @@ abstract class CategoryDBAdapter {
* @return a new record for the new category.
* @throws IOException if IO error occurs
*/
abstract Record createCategory(String name, long parentID) throws IOException;
abstract DBRecord createCategory(String name, long parentID) throws IOException;
/**
* Removes the category with the given ID.
@ -82,9 +82,9 @@ abstract class CategoryDBAdapter {
* @return root category record
* @throws IOException if IO error occurs
*/
abstract Record getRootRecord() throws IOException;
abstract DBRecord getRootRecord() throws IOException;
abstract void putRecord(Record record) throws IOException;
abstract void putRecord(DBRecord record) throws IOException;
abstract int getRecordCount();
}

View file

@ -56,7 +56,7 @@ class CategoryDBAdapterV0 extends CategoryDBAdapter {
}
@Override
public Record getRecord(long categoryID) throws IOException {
public DBRecord getRecord(long categoryID) throws IOException {
return table.getRecord(categoryID);
}
@ -67,24 +67,24 @@ class CategoryDBAdapterV0 extends CategoryDBAdapter {
@Override
void updateRecord(long categoryID, long parentID, String name) throws IOException {
Record rec = table.getSchema().createRecord(categoryID);
DBRecord rec = table.getSchema().createRecord(categoryID);
rec.setString(V0_CATEGORY_NAME_COL, name);
rec.setLongValue(V0_CATEGORY_PARENT_COL, parentID);
table.putRecord(rec);
}
@Override
void putRecord(Record record) throws IOException {
void putRecord(DBRecord record) throws IOException {
table.putRecord(record);
}
@Override
public Record createCategory(String name, long parentID) throws IOException {
public DBRecord createCategory(String name, long parentID) throws IOException {
long key = table.getKey();
if (key == 0) {
key = 1;
}
Record rec = table.getSchema().createRecord(key);
DBRecord rec = table.getSchema().createRecord(key);
rec.setString(V0_CATEGORY_NAME_COL, name);
rec.setLongValue(V0_CATEGORY_PARENT_COL, parentID);
table.putRecord(rec);
@ -98,7 +98,7 @@ class CategoryDBAdapterV0 extends CategoryDBAdapter {
}
@Override
public Record getRootRecord() throws IOException {
public DBRecord getRootRecord() throws IOException {
Field[] keys = table.findRecords(new LongField(-1), V0_CATEGORY_PARENT_COL);
if (keys.length != 1) {
throw new IOException("Found " + keys.length + " entries for root category");

View file

@ -65,7 +65,7 @@ abstract class ComponentDBAdapter {
* @return the component data type record.
* @throws IOException if there is a problem accessing the database.
*/
abstract Record createRecord(long dataTypeID, long parentID, int length, int ordinal,
abstract DBRecord createRecord(long dataTypeID, long parentID, int length, int ordinal,
int offset, String name, String comment) throws IOException;
/**
@ -74,7 +74,7 @@ abstract class ComponentDBAdapter {
* @return the component record
* @throws IOException if there is a problem accessing the database.
*/
abstract Record getRecord(long componentID) throws IOException;
abstract DBRecord getRecord(long componentID) throws IOException;
/**
* Removes the component data type record with the specified ID.
@ -89,7 +89,7 @@ abstract class ComponentDBAdapter {
* @param record the new record
* @throws IOException if there is a problem accessing the database.
*/
abstract void updateRecord(Record record) throws IOException;
abstract void updateRecord(DBRecord record) throws IOException;
/**
* Gets an array with all of the IDs of the defined components within the composite data type indicated.

View file

@ -74,7 +74,7 @@ class ComponentDBAdapterV0 extends ComponentDBAdapter {
}
@Override
public Record createRecord(long dataTypeID, long parentID, int length, int ordinal, int offset,
public DBRecord createRecord(long dataTypeID, long parentID, int length, int ordinal, int offset,
String name, String comment) throws IOException {
long tableKey = componentTable.getKey();
@ -82,7 +82,7 @@ class ComponentDBAdapterV0 extends ComponentDBAdapter {
// tableKey = DataManager.VOID_DATATYPE_ID +1;
// }
long key = DataTypeManagerDB.createKey(DataTypeManagerDB.COMPONENT, tableKey);
Record record = ComponentDBAdapter.COMPONENT_SCHEMA.createRecord(key);
DBRecord record = ComponentDBAdapter.COMPONENT_SCHEMA.createRecord(key);
record.setLongValue(ComponentDBAdapter.COMPONENT_PARENT_ID_COL, parentID);
record.setLongValue(ComponentDBAdapter.COMPONENT_OFFSET_COL, offset);
record.setLongValue(ComponentDBAdapter.COMPONENT_DT_ID_COL, dataTypeID);
@ -95,12 +95,12 @@ class ComponentDBAdapterV0 extends ComponentDBAdapter {
}
@Override
public Record getRecord(long componentID) throws IOException {
public DBRecord getRecord(long componentID) throws IOException {
return componentTable.getRecord(componentID);
}
@Override
public void updateRecord(Record record) throws IOException {
public void updateRecord(DBRecord record) throws IOException {
componentTable.putRecord(record);
}

View file

@ -17,7 +17,7 @@ package ghidra.program.database.data;
import java.io.IOException;
import db.Record;
import db.DBRecord;
import ghidra.docking.settings.Settings;
import ghidra.program.database.DBObjectCache;
import ghidra.program.model.data.*;
@ -55,7 +55,7 @@ abstract class CompositeDB extends DataTypeDB implements Composite {
*/
CompositeDB(DataTypeManagerDB dataMgr, DBObjectCache<DataTypeDB> cache,
CompositeDBAdapter compositeAdapter, ComponentDBAdapter componentAdapter,
Record record) {
DBRecord record) {
super(dataMgr, cache, record);
this.compositeAdapter = compositeAdapter;
this.componentAdapter = componentAdapter;
@ -154,7 +154,7 @@ abstract class CompositeDB extends DataTypeDB implements Composite {
@Override
protected boolean refresh() {
try {
Record rec = compositeAdapter.getRecord(key);
DBRecord rec = compositeAdapter.getRecord(key);
if (rec != null) {
record = rec;
initialize();

View file

@ -136,7 +136,7 @@ abstract class CompositeDBAdapter {
RecordIterator it = oldAdapter.getRecords();
while (it.hasNext()) {
monitor.checkCanceled();
Record rec = it.next();
DBRecord rec = it.next();
tmpAdapter.updateRecord(rec, false);
}
oldAdapter.deleteTable(handle);
@ -144,7 +144,7 @@ abstract class CompositeDBAdapter {
it = tmpAdapter.getRecords();
while (it.hasNext()) {
monitor.checkCanceled();
Record rec = it.next();
DBRecord rec = it.next();
newAdapter.updateRecord(rec, false);
}
return newAdapter;
@ -172,7 +172,7 @@ abstract class CompositeDBAdapter {
* @return the database record for this data type.
* @throws IOException if the database can't be accessed.
*/
abstract Record createRecord(String name, String comments, boolean isUnion, long categoryID,
abstract DBRecord createRecord(String name, String comments, boolean isUnion, long categoryID,
int length, long sourceArchiveID, long sourceDataTypeID, long lastChangeTime,
int internalAlignment, int externalAlignment) throws IOException;
@ -182,7 +182,7 @@ abstract class CompositeDBAdapter {
* @return the record for the composite (structure or union) data type.
* @throws IOException if the database can't be accessed.
*/
abstract Record getRecord(long dataTypeID) throws IOException;
abstract DBRecord getRecord(long dataTypeID) throws IOException;
/**
* Gets an iterator over all composite (structure and union) data type records.
@ -198,7 +198,7 @@ abstract class CompositeDBAdapter {
* current time before putting the record in the database.
* @throws IOException if the database can't be accessed.
*/
abstract void updateRecord(Record record, boolean setLastChangeTime) throws IOException;
abstract void updateRecord(DBRecord record, boolean setLastChangeTime) throws IOException;
/**
* Removes the composite data type record with the specified ID.
@ -240,7 +240,7 @@ abstract class CompositeDBAdapter {
* @return composite record found or null
* @throws IOException if IO error occurs
*/
abstract Record getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID)
abstract DBRecord getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID)
throws IOException;
}

View file

@ -68,7 +68,7 @@ class CompositeDBAdapterV0 extends CompositeDBAdapter implements RecordTranslato
}
@Override
public Record createRecord(String name, String comments, boolean isUnion, long categoryID,
public DBRecord createRecord(String name, String comments, boolean isUnion, long categoryID,
int length, long sourceArchiveID, long sourceDataTypeID, long lastChangeTime,
int internalAlignment, int externalAlignment) throws IOException {
throw new UnsupportedOperationException("Not allowed to update prior version #" + VERSION +
@ -76,7 +76,7 @@ class CompositeDBAdapterV0 extends CompositeDBAdapter implements RecordTranslato
}
@Override
public Record getRecord(long dataTypeID) throws IOException {
public DBRecord getRecord(long dataTypeID) throws IOException {
return translateRecord(compositeTable.getRecord(dataTypeID));
}
@ -86,7 +86,7 @@ class CompositeDBAdapterV0 extends CompositeDBAdapter implements RecordTranslato
}
@Override
public void updateRecord(Record record, boolean setLastChangeTime) throws IOException {
public void updateRecord(DBRecord record, boolean setLastChangeTime) throws IOException {
throw new UnsupportedOperationException();
}
@ -112,11 +112,11 @@ class CompositeDBAdapterV0 extends CompositeDBAdapter implements RecordTranslato
}
@Override
public Record translateRecord(Record oldRec) {
public DBRecord translateRecord(DBRecord oldRec) {
if (oldRec == null) {
return null;
}
Record rec = CompositeDBAdapter.COMPOSITE_SCHEMA.createRecord(oldRec.getKey());
DBRecord rec = CompositeDBAdapter.COMPOSITE_SCHEMA.createRecord(oldRec.getKey());
rec.setString(COMPOSITE_NAME_COL, oldRec.getString(V0_COMPOSITE_NAME_COL));
rec.setString(COMPOSITE_COMMENT_COL, oldRec.getString(V0_COMPOSITE_COMMENT_COL));
rec.setBooleanValue(COMPOSITE_IS_UNION_COL,
@ -135,7 +135,7 @@ class CompositeDBAdapterV0 extends CompositeDBAdapter implements RecordTranslato
}
@Override
Record getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
DBRecord getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
return null;
}

View file

@ -71,7 +71,7 @@ class CompositeDBAdapterV1 extends CompositeDBAdapter implements RecordTranslato
}
@Override
public Record createRecord(String name, String comments, boolean isUnion, long categoryID,
public DBRecord createRecord(String name, String comments, boolean isUnion, long categoryID,
int length, long sourceArchiveID, long sourceDataTypeID, long lastChangeTime,
int internalAlignment, int externalAlignment) throws IOException {
throw new UnsupportedOperationException("Not allowed to update prior version #" + VERSION +
@ -79,7 +79,7 @@ class CompositeDBAdapterV1 extends CompositeDBAdapter implements RecordTranslato
}
@Override
public Record getRecord(long dataTypeID) throws IOException {
public DBRecord getRecord(long dataTypeID) throws IOException {
return translateRecord(compositeTable.getRecord(dataTypeID));
}
@ -89,7 +89,7 @@ class CompositeDBAdapterV1 extends CompositeDBAdapter implements RecordTranslato
}
@Override
public void updateRecord(Record record, boolean setLastChangeTime) throws IOException {
public void updateRecord(DBRecord record, boolean setLastChangeTime) throws IOException {
throw new UnsupportedOperationException();
}
@ -119,11 +119,11 @@ class CompositeDBAdapterV1 extends CompositeDBAdapter implements RecordTranslato
* @see db.RecordTranslator#translateRecord(db.Record)
*/
@Override
public Record translateRecord(Record oldRec) {
public DBRecord translateRecord(DBRecord oldRec) {
if (oldRec == null) {
return null;
}
Record rec = CompositeDBAdapter.COMPOSITE_SCHEMA.createRecord(oldRec.getKey());
DBRecord rec = CompositeDBAdapter.COMPOSITE_SCHEMA.createRecord(oldRec.getKey());
rec.setString(COMPOSITE_NAME_COL, oldRec.getString(V1_COMPOSITE_NAME_COL));
rec.setString(COMPOSITE_COMMENT_COL, oldRec.getString(V1_COMPOSITE_COMMENT_COL));
rec.setBooleanValue(COMPOSITE_IS_UNION_COL,
@ -146,12 +146,12 @@ class CompositeDBAdapterV1 extends CompositeDBAdapter implements RecordTranslato
}
@Override
Record getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
DBRecord getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
Field[] keys = compositeTable.findRecords(new LongField(datatypeID.getValue()),
V1_COMPOSITE_UNIVERSAL_DT_ID_COL);
for (int i = 0; i < keys.length; i++) {
Record record = compositeTable.getRecord(keys[i]);
DBRecord record = compositeTable.getRecord(keys[i]);
if (record.getLongValue(V1_COMPOSITE_SOURCE_ARCHIVE_ID_COL) == sourceID.getValue()) {
return translateRecord(record);
}

View file

@ -123,7 +123,7 @@ class CompositeDBAdapterV2V3 extends CompositeDBAdapter {
}
@Override
public Record createRecord(String name, String comments, boolean isUnion, long categoryID,
public DBRecord createRecord(String name, String comments, boolean isUnion, long categoryID,
int length, long sourceArchiveID, long sourceDataTypeID, long lastChangeTime,
int internalAlignment, int externalAlignment) throws IOException {
if (readOnly) {
@ -137,7 +137,7 @@ class CompositeDBAdapterV2V3 extends CompositeDBAdapter {
// tableKey = DataManager.VOID_DATATYPE_ID +1;
// }
long key = DataTypeManagerDB.createKey(DataTypeManagerDB.COMPOSITE, tableKey);
Record record = CompositeDBAdapter.COMPOSITE_SCHEMA.createRecord(key);
DBRecord record = CompositeDBAdapter.COMPOSITE_SCHEMA.createRecord(key);
record.setString(V2_COMPOSITE_NAME_COL, name);
record.setString(V2_COMPOSITE_COMMENT_COL, comments);
@ -156,7 +156,7 @@ class CompositeDBAdapterV2V3 extends CompositeDBAdapter {
}
@Override
public Record getRecord(long dataTypeID) throws IOException {
public DBRecord getRecord(long dataTypeID) throws IOException {
return compositeTable.getRecord(dataTypeID);
}
@ -166,7 +166,7 @@ class CompositeDBAdapterV2V3 extends CompositeDBAdapter {
}
@Override
public void updateRecord(Record record, boolean setLastChangeTime) throws IOException {
public void updateRecord(DBRecord record, boolean setLastChangeTime) throws IOException {
if (readOnly) {
throw new ReadOnlyException();
}
@ -203,12 +203,12 @@ class CompositeDBAdapterV2V3 extends CompositeDBAdapter {
}
@Override
Record getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
DBRecord getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
Field[] keys = compositeTable.findRecords(new LongField(datatypeID.getValue()),
V2_COMPOSITE_UNIVERSAL_DT_ID_COL);
for (int i = 0; i < keys.length; i++) {
Record record = compositeTable.getRecord(keys[i]);
DBRecord record = compositeTable.getRecord(keys[i]);
if (record.getLongValue(V2_COMPOSITE_SOURCE_ARCHIVE_ID_COL) == sourceID.getValue()) {
return record;
}

View file

@ -20,7 +20,7 @@ package ghidra.program.database.data;
import java.io.IOException;
import db.Record;
import db.DBRecord;
import ghidra.docking.settings.Settings;
import ghidra.program.model.data.*;
import ghidra.util.SystemUtilities;
@ -35,7 +35,7 @@ class DataTypeComponentDB implements InternalDataTypeComponent {
private final DataTypeManagerDB dataMgr;
private final ComponentDBAdapter adapter;
private final Record record; // null record -> undefined component
private final DBRecord record; // null record -> undefined component
private final Composite parent;
private DataType cachedDataType; // required for bit-fields during packing process
@ -78,7 +78,7 @@ class DataTypeComponentDB implements InternalDataTypeComponent {
* @param record
*/
DataTypeComponentDB(DataTypeManagerDB dataMgr, ComponentDBAdapter adapter, Composite parent,
Record record) {
DBRecord record) {
this.dataMgr = dataMgr;
this.adapter = adapter;
this.record = record;
@ -438,7 +438,7 @@ class DataTypeComponentDB implements InternalDataTypeComponent {
}
}
Record getRecord() {
DBRecord getRecord() {
return record;
}

View file

@ -22,7 +22,7 @@ import java.util.List;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import db.Record;
import db.DBRecord;
import ghidra.docking.settings.Settings;
import ghidra.docking.settings.SettingsDefinition;
import ghidra.program.database.DBObjectCache;
@ -40,7 +40,7 @@ import ghidra.util.exception.NotYetImplementedException;
*/
abstract class DataTypeDB extends DatabaseObject implements DataType, ChangeListener {
protected Record record;
protected DBRecord record;
protected final DataTypeManagerDB dataMgr;
private volatile Settings defaultSettings;
private final static SettingsDefinition[] EMPTY_DEFINITIONS = new SettingsDefinition[0];
@ -51,7 +51,7 @@ abstract class DataTypeDB extends DatabaseObject implements DataType, ChangeList
private volatile Category category;
protected DataTypeDB(DataTypeManagerDB dataMgr, DBObjectCache<DataTypeDB> cache,
Record record) {
DBRecord record) {
super(cache, record.getKey());
this.dataMgr = dataMgr;
this.record = record;

View file

@ -701,7 +701,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
}
CategoryDB cat = catCache.get(id);
if (cat == null) {
Record rec = categoryAdapter.getRecord(id);
DBRecord rec = categoryAdapter.getRecord(id);
if (rec != null) {
long parentID = rec.getLongValue(CategoryDBAdapter.CATEGORY_PARENT_COL);
CategoryDB parent = getCategoryDB(parentID);
@ -717,7 +717,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
if (c != null) {
return c;
}
Record rec = categoryAdapter.createCategory(categoryName, parent.getKey());
DBRecord rec = categoryAdapter.createCategory(categoryName, parent.getKey());
String name = rec.getString(CategoryDBAdapter.CATEGORY_NAME_COL);
CategoryDB cat = new CategoryDB(this, catCache, rec.getKey(), parent, name);
parent.categoryAdded(cat);// must be before the event notification below
@ -1180,7 +1180,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
return getSourceArchive(sourceArchive.getSourceArchiveID());
}
try {
Record record = sourceArchiveAdapter.createRecord(sourceArchive);
DBRecord record = sourceArchiveAdapter.createRecord(sourceArchive);
SourceArchive newSourceArchive = getSourceArchiveDB(record);
invalidateSourceArchiveCache();
sourceArchiveAdded(newSourceArchive.getSourceArchiveID());
@ -2029,7 +2029,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
return (int) (dataID >> DATA_TYPE_KIND_SHIFT);
}
private DataType getDataType(long dataTypeID, Record record) {
private DataType getDataType(long dataTypeID, DBRecord record) {
int tableId = getTableID(dataTypeID);
switch (tableId) {
case BUILT_IN:
@ -2053,7 +2053,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
}
}
private DataType getBuiltInDataType(long dataTypeID, Record record) {
private DataType getBuiltInDataType(long dataTypeID, DBRecord record) {
lock.acquire();
try {
Long key = dataTypeID;
@ -2118,7 +2118,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
return null;
}
private Enum getEnumDataType(long dataTypeID, Record record) {
private Enum getEnumDataType(long dataTypeID, DBRecord record) {
lock.acquire();
try {
EnumDB enu = (EnumDB) dtCache.get(dataTypeID);
@ -2141,7 +2141,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
return null;
}
private Composite getCompositeDataType(long dataTypeID, Record record) {
private Composite getCompositeDataType(long dataTypeID, DBRecord record) {
lock.acquire();
try {
CompositeDB comp = (CompositeDB) dtCache.get(dataTypeID);
@ -2171,7 +2171,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
return null;
}
private TypeDef getTypedefDataType(long dataTypeID, Record record) {
private TypeDef getTypedefDataType(long dataTypeID, DBRecord record) {
lock.acquire();
try {
TypedefDB typeDB = (TypedefDB) dtCache.get(dataTypeID);
@ -2194,7 +2194,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
return null;
}
private Array getArrayDataType(long dataTypeID, Record record) {
private Array getArrayDataType(long dataTypeID, DBRecord record) {
lock.acquire();
try {
ArrayDB arrayDB = (ArrayDB) dtCache.get(dataTypeID);
@ -2218,7 +2218,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
return null;
}
private Pointer getPointerDataType(long dataTypeID, Record record) {
private Pointer getPointerDataType(long dataTypeID, DBRecord record) {
lock.acquire();
try {
PointerDB ptrDB = (PointerDB) dtCache.get(dataTypeID);
@ -2242,7 +2242,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
return null;
}
private FunctionDefinition getFunctionDefDataType(long dataTypeID, Record record) {
private FunctionDefinition getFunctionDefDataType(long dataTypeID, DBRecord record) {
lock.acquire();
try {
FunctionDefinitionDB funDef = (FunctionDefinitionDB) dtCache.get(dataTypeID);
@ -2356,7 +2356,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
if (struct.isNotYetDefined() || struct.isInternallyAligned()) {
len = 0;
}
Record record = compositeAdapter.createRecord(name, struct.getDescription(), false,
DBRecord record = compositeAdapter.createRecord(name, struct.getDescription(), false,
category.getID(), len, sourceArchiveIdValue, universalIdValue,
struct.getLastChangeTime(), getInternalAlignment(struct),
getExternalAlignment(struct));
@ -2421,7 +2421,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
throw new IllegalArgumentException("Data type must have a valid name");
}
DataType dataType = resolve(typedef.getDataType(), getDependencyConflictHandler());
Record record = typedefAdapter.createRecord(getID(dataType), name, cat.getID(),
DBRecord record = typedefAdapter.createRecord(getID(dataType), name, cat.getID(),
sourceArchiveIdValue, universalIdValue, typedef.getLastChangeTime());
TypedefDB typedefDB = new TypedefDB(this, dtCache, typedefAdapter, record);
dataType.addParent(typedefDB);
@ -2437,7 +2437,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
}
try {
creatingDataType++;
Record record = compositeAdapter.createRecord(name, null, true, category.getID(), 0,
DBRecord record = compositeAdapter.createRecord(name, null, true, category.getID(), 0,
sourceArchiveIdValue, universalIdValue, union.getLastChangeTime(),
getInternalAlignment(union), getExternalAlignment(union));
UnionDB unionDB =
@ -2467,7 +2467,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
if (name == null || name.length() == 0) {
throw new IllegalArgumentException("Data type must have a valid name");
}
Record record = enumAdapter.createRecord(name, enumm.getDescription(), cat.getID(),
DBRecord record = enumAdapter.createRecord(name, enumm.getDescription(), cat.getID(),
(byte) enumm.getLength(), sourceArchiveIdValue, universalIdValue,
enumm.getLastChangeTime());
long enumID = record.getKey();
@ -2487,7 +2487,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
}
long dataTypeID = getResolvedID(dt);
Record record = pointerAdapter.createRecord(dataTypeID, cat.getID(), length);
DBRecord record = pointerAdapter.createRecord(dataTypeID, cat.getID(), length);
PointerDB ptrDB = new PointerDB(this, dtCache, pointerAdapter, record);
if (dt != null) {
dt.addParent(ptrDB);
@ -2518,7 +2518,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
elementLength = -1;
}
Record record =
DBRecord record =
arrayAdapter.createRecord(dataTypeID, numElements, elementLength, cat.getID());
addParentChildRecord(record.getKey(), dataTypeID);
ArrayDB arrayDB = new ArrayDB(this, dtCache, arrayAdapter, record);
@ -2617,8 +2617,8 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
Map<UniversalID, SourceArchive> archiveMap = new HashMap<>();
archiveMap.put(BUILT_IN_ARCHIVE_UNIVERSAL_ID, BuiltInSourceArchive.INSTANCE);
try {
List<Record> records = sourceArchiveAdapter.getRecords();
for (Record record : records) {
List<DBRecord> records = sourceArchiveAdapter.getRecords();
for (DBRecord record : records) {
SourceArchive sourceArchive = getSourceArchiveDB(record);
archiveMap.put(sourceArchive.getSourceArchiveID(), sourceArchive);
}
@ -2630,7 +2630,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
sourceArchiveMap = archiveMap;
}
private SourceArchiveDB getSourceArchiveDB(Record record) {
private SourceArchiveDB getSourceArchiveDB(DBRecord record) {
SourceArchiveDB archive = sourceArchiveDBCache.get(record.getKey());
if (archive == null) {
archive = new SourceArchiveDB(this, sourceArchiveDBCache, sourceArchiveAdapter, record);
@ -2674,14 +2674,14 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
private DataType createMissingBuiltIn(MissingBuiltInDataType dt, Category category)
throws IOException {
Record record = builtinAdapter.createRecord(dt.getMissingBuiltInName(),
DBRecord record = builtinAdapter.createRecord(dt.getMissingBuiltInName(),
dt.getMissingBuiltInClassPath(), category.getID());
return getBuiltInDataType(record.getKey(), record);
}
private DataType createBuiltIn(BuiltInDataType dt, Category category) throws IOException {
Record record =
DBRecord record =
builtinAdapter.createRecord(dt.getName(), dt.getClass().getName(), category.getID());
return getBuiltInDataType(record.getKey(), record);
}
@ -2693,7 +2693,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
}
try {
creatingDataType++;
Record record = functionDefAdapter.createRecord(name, funDef.getComment(), cat.getID(),
DBRecord record = functionDefAdapter.createRecord(name, funDef.getComment(), cat.getID(),
DEFAULT_DATATYPE_ID, funDef.hasVarArgs(), funDef.getGenericCallingConvention(),
sourceArchiveIdValue, universalIdValue, funDef.getLastChangeTime());
FunctionDefinitionDB funDefDb =
@ -2749,7 +2749,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
private void getNextStruct() {
try {
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
DataType dt = getDataType(rec.getKey(), rec);
if (dt instanceof Structure) {
nextStruct = (StructureDB) dt;
@ -2797,7 +2797,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
private void getNextComposite() {
try {
if (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
nextComposite = (CompositeDB) getDataType(rec.getKey(), rec);
}
}
@ -2856,13 +2856,13 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
try {
for (Field arrayId : arrayAdapter.getRecordIdsInCategory(oldCatId)) {
long id = arrayId.getLongValue();
Record rec = arrayAdapter.getRecord(id);
DBRecord rec = arrayAdapter.getRecord(id);
ArrayDB array = (ArrayDB) getDataType(id, rec);
array.updatePath(dt);
}
for (Field ptrId : pointerAdapter.getRecordIdsInCategory(oldCatId)) {
long id = ptrId.getLongValue();
Record rec = pointerAdapter.getRecord(id);
DBRecord rec = pointerAdapter.getRecord(id);
PointerDB ptr = (PointerDB) getDataType(id, rec);
ptr.updatePath(dt);
}
@ -3234,7 +3234,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
instanceSettingsAdapter.getRecords(range.minKey, range.maxKey);
while (iter.hasNext()) {
monitor.checkCanceled();
Record rec = iter.next();
DBRecord rec = iter.next();
tmpTable.putRecord(rec);
iter.delete();
}
@ -3243,7 +3243,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
RecordIterator iter = tmpTable.iterator();
while (iter.hasNext()) {
monitor.checkCanceled();
Record rec = iter.next();
DBRecord rec = iter.next();
// update address column and re-introduce into table
Address addr = addrMap.decodeAddress(
rec.getLongValue(InstanceSettingsDBAdapter.INST_ADDR_COL));
@ -3291,7 +3291,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
Field[] keys = instanceSettingsAdapter.getInstanceKeys(addrMap.getKey(dataAddr, false));
ArrayList<String> list = new ArrayList<>();
for (Field key : keys) {
Record rec = instanceSettingsAdapter.getInstanceRecord(key.getLongValue());
DBRecord rec = instanceSettingsAdapter.getInstanceRecord(key.getLongValue());
list.add(rec.getString(InstanceSettingsDBAdapter.INST_NAME_COL));
}
String[] names = new String[list.size()];
@ -3342,13 +3342,13 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
wasChanged = true;
// create new record
Record rec = instanceSettingsAdapter.createInstanceRecord(
DBRecord rec = instanceSettingsAdapter.createInstanceRecord(
addrMap.getKey(dataAddr, true), name, strValue, longValue, byteValue);
settings = new InstanceSettingsDB(rec);
settingsCache.put(dataAddr, name, settings);
}
else {
Record rec = settings.getRecord();
DBRecord rec = settings.getRecord();
String recStrValue = rec.getString(SettingsDBAdapter.SETTINGS_STRING_VALUE_COL);
byte[] recByteValue = rec.getBinaryData(SettingsDBAdapter.SETTINGS_BYTE_VALUE_COL);
long recLongValue = rec.getLongValue(SettingsDBAdapter.SETTINGS_LONG_VALUE_COL);
@ -3383,7 +3383,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
return settings;
}
long addr = addrMap.getKey(dataAddr, false);
Record rec = getInstanceRecord(addr, name);
DBRecord rec = getInstanceRecord(addr, name);
if (rec != null) {
settings = new InstanceSettingsDB(rec);
settingsCache.put(dataAddr, name, settings);
@ -3396,11 +3396,11 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
}
}
private Record getInstanceRecord(long addr, String name) {
private DBRecord getInstanceRecord(long addr, String name) {
try {
Field[] keys = instanceSettingsAdapter.getInstanceKeys(addr);
for (Field key : keys) {
Record rec = instanceSettingsAdapter.getInstanceRecord(key.getLongValue());
DBRecord rec = instanceSettingsAdapter.getInstanceRecord(key.getLongValue());
if (rec.getString(InstanceSettingsDBAdapter.INST_NAME_COL).equals(name)) {
return rec;
}
@ -3718,7 +3718,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
private DataType findDataTypeForIDs(UniversalID sourceID, UniversalID datatypeID) {
lock.acquire();
Record record = null;
DBRecord record = null;
try {
record = typedefAdapter.getRecordWithIDs(sourceID, datatypeID);
if (record == null) {
@ -3756,8 +3756,8 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
if (openMode == DBConstants.CREATE || openMode == DBConstants.READ_ONLY) {
return false;
}
List<Record> records = sourceArchiveAdapter.getRecords();
for (Record record : records) {
List<DBRecord> records = sourceArchiveAdapter.getRecords();
for (DBRecord record : records) {
if (SourceArchiveUpgradeMap.isReplacedSourceArchive(record.getKey())) {
return true;
}
@ -4208,9 +4208,9 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
*/
class InstanceSettingsDB {
private Record record;
private DBRecord record;
InstanceSettingsDB(Record record) {
InstanceSettingsDB(DBRecord record) {
this.record = record;
}
@ -4230,7 +4230,7 @@ class InstanceSettingsDB {
return record.getLongValue(InstanceSettingsDBAdapter.INST_LONG_VALUE_COL);
}
Record getRecord() {
DBRecord getRecord() {
return record;
}

View file

@ -20,7 +20,7 @@ import java.math.BigInteger;
import java.util.*;
import db.Field;
import db.Record;
import db.DBRecord;
import ghidra.docking.settings.Settings;
import ghidra.docking.settings.SettingsDefinition;
import ghidra.program.database.DBObjectCache;
@ -47,7 +47,7 @@ class EnumDB extends DataTypeDB implements Enum {
private List<BitGroup> bitGroups;
EnumDB(DataTypeManagerDB dataMgr, DBObjectCache<DataTypeDB> cache, EnumDBAdapter adapter,
EnumValueDBAdapter valueAdapter, Record record) {
EnumValueDBAdapter valueAdapter, DBRecord record) {
super(dataMgr, cache, record);
this.adapter = adapter;
this.valueAdapter = valueAdapter;
@ -88,7 +88,7 @@ class EnumDB extends DataTypeDB implements Enum {
Field[] ids = valueAdapter.getValueIdsInEnum(key);
for (Field id : ids) {
Record rec = valueAdapter.getRecord(id.getLongValue());
DBRecord rec = valueAdapter.getRecord(id.getLongValue());
String valueName = rec.getString(EnumValueDBAdapter.ENUMVAL_NAME_COL);
long value = rec.getLongValue(EnumValueDBAdapter.ENUMVAL_VALUE_COL);
addToCache(valueName, value);
@ -256,7 +256,7 @@ class EnumDB extends DataTypeDB implements Enum {
Field[] ids = valueAdapter.getValueIdsInEnum(key);
for (Field id : ids) {
Record rec = valueAdapter.getRecord(id.getLongValue());
DBRecord rec = valueAdapter.getRecord(id.getLongValue());
if (valueName.equals(rec.getString(EnumValueDBAdapter.ENUMVAL_NAME_COL))) {
valueAdapter.removeRecord(id.getLongValue());
break;
@ -554,7 +554,7 @@ class EnumDB extends DataTypeDB implements Enum {
nameMap = null;
valueMap = null;
bitGroups = null;
Record rec = adapter.getRecord(key);
DBRecord rec = adapter.getRecord(key);
if (rec != null) {
record = rec;
return super.refresh();

View file

@ -108,14 +108,14 @@ abstract class EnumDBAdapter {
tmpAdapter = new EnumDBAdapterV1(tmpHandle, true);
RecordIterator it = oldAdapter.getRecords();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
tmpAdapter.updateRecord(rec, false);
}
oldAdapter.deleteTable(handle);
EnumDBAdapterV1 newAdapter = new EnumDBAdapterV1(handle, true);
it = tmpAdapter.getRecords();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
newAdapter.updateRecord(rec, false);
}
return newAdapter;
@ -138,7 +138,7 @@ abstract class EnumDBAdapter {
* @return the database record for this data type.
* @throws IOException if the database can't be accessed.
*/
abstract Record createRecord(String name, String comments, long categoryID, byte size,
abstract DBRecord createRecord(String name, String comments, long categoryID, byte size,
long sourceArchiveID, long sourceDataTypeID, long lastChangeTime) throws IOException;
/**
@ -147,7 +147,7 @@ abstract class EnumDBAdapter {
* @return the record for the enumeration data type.
* @throws IOException if the database can't be accessed.
*/
abstract Record getRecord(long enumID) throws IOException;
abstract DBRecord getRecord(long enumID) throws IOException;
/**
* Gets an iterator over all enumeration data type records.
@ -163,7 +163,7 @@ abstract class EnumDBAdapter {
* current time before putting the record in the database.
* @throws IOException if the database can't be accessed.
*/
abstract void updateRecord(Record record, boolean setLastChangeTime) throws IOException;
abstract void updateRecord(DBRecord record, boolean setLastChangeTime) throws IOException;
/**
* Remove the record for the given enumeration ID, and remove all of its
@ -204,7 +204,7 @@ abstract class EnumDBAdapter {
* @return enum record found or null
* @throws IOException if IO error occurs
*/
abstract Record getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID)
abstract DBRecord getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID)
throws IOException;
}

View file

@ -34,14 +34,14 @@ class EnumDBAdapterNoTable extends EnumDBAdapter {
}
@Override
public Record createRecord(String name, String comments, long categoryID, byte size,
public DBRecord createRecord(String name, String comments, long categoryID, byte size,
long sourceArchiveID, long sourceDataTypeID, long lastChangeTime) throws IOException {
throw new UnsupportedOperationException(
"Not allowed to update version prior to existence of Enumeration Data Types table.");
}
@Override
public Record getRecord(long enumID) throws IOException {
public DBRecord getRecord(long enumID) throws IOException {
return null;
}
@ -51,7 +51,7 @@ class EnumDBAdapterNoTable extends EnumDBAdapter {
}
@Override
public void updateRecord(Record record, boolean setLastChangeTime) throws IOException {
public void updateRecord(DBRecord record, boolean setLastChangeTime) throws IOException {
throw new UnsupportedOperationException();
}
@ -75,7 +75,7 @@ class EnumDBAdapterNoTable extends EnumDBAdapter {
}
@Override
Record getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
DBRecord getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
return null;
}

View file

@ -67,14 +67,14 @@ class EnumDBAdapterV0 extends EnumDBAdapter implements RecordTranslator {
}
@Override
public Record createRecord(String name, String comments, long categoryID, byte size,
public DBRecord createRecord(String name, String comments, long categoryID, byte size,
long sourceArchiveID, long sourceDataTypeID, long lastChangeTime) throws IOException {
throw new UnsupportedOperationException("Not allowed to update prior version #" + VERSION +
" of " + ENUM_TABLE_NAME + " table.");
}
@Override
public Record getRecord(long enumID) throws IOException {
public DBRecord getRecord(long enumID) throws IOException {
return translateRecord(enumTable.getRecord(enumID));
}
@ -84,7 +84,7 @@ class EnumDBAdapterV0 extends EnumDBAdapter implements RecordTranslator {
}
@Override
public void updateRecord(Record record, boolean setLastChangeTime) throws IOException {
public void updateRecord(DBRecord record, boolean setLastChangeTime) throws IOException {
throw new UnsupportedOperationException();
}
@ -110,11 +110,11 @@ class EnumDBAdapterV0 extends EnumDBAdapter implements RecordTranslator {
}
@Override
public Record translateRecord(Record oldRec) {
public DBRecord translateRecord(DBRecord oldRec) {
if (oldRec == null) {
return null;
}
Record rec = EnumDBAdapter.ENUM_SCHEMA.createRecord(oldRec.getKey());
DBRecord rec = EnumDBAdapter.ENUM_SCHEMA.createRecord(oldRec.getKey());
rec.setString(ENUM_NAME_COL, oldRec.getString(V0_ENUM_NAME_COL));
rec.setString(ENUM_COMMENT_COL, oldRec.getString(V0_ENUM_COMMENT_COL));
rec.setLongValue(ENUM_CAT_COL, oldRec.getLongValue(V0_ENUM_CAT_COL));
@ -127,7 +127,7 @@ class EnumDBAdapterV0 extends EnumDBAdapter implements RecordTranslator {
}
@Override
Record getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
DBRecord getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
return null;
}

View file

@ -78,11 +78,11 @@ class EnumDBAdapterV1 extends EnumDBAdapter {
}
@Override
public Record createRecord(String name, String comments, long categoryID, byte size,
public DBRecord createRecord(String name, String comments, long categoryID, byte size,
long sourceArchiveID, long sourceDataTypeID, long lastChangeTime) throws IOException {
long tableKey = enumTable.getKey();
long key = DataTypeManagerDB.createKey(DataTypeManagerDB.ENUM, tableKey);
Record record = V1_ENUM_SCHEMA.createRecord(key);
DBRecord record = V1_ENUM_SCHEMA.createRecord(key);
record.setString(V1_ENUM_NAME_COL, name);
record.setString(V1_ENUM_COMMENT_COL, comments);
record.setLongValue(V1_ENUM_CAT_COL, categoryID);
@ -96,7 +96,7 @@ class EnumDBAdapterV1 extends EnumDBAdapter {
}
@Override
public Record getRecord(long enumID) throws IOException {
public DBRecord getRecord(long enumID) throws IOException {
return enumTable.getRecord(enumID);
}
@ -106,7 +106,7 @@ class EnumDBAdapterV1 extends EnumDBAdapter {
}
@Override
public void updateRecord(Record record, boolean setLastChangeTime) throws IOException {
public void updateRecord(DBRecord record, boolean setLastChangeTime) throws IOException {
if (setLastChangeTime) {
record.setLongValue(EnumDBAdapter.ENUM_LAST_CHANGE_TIME_COL, (new Date()).getTime());
}
@ -135,12 +135,12 @@ class EnumDBAdapterV1 extends EnumDBAdapter {
}
@Override
Record getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
DBRecord getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
Field[] keys = enumTable.findRecords(new LongField(datatypeID.getValue()),
V1_ENUM_UNIVERSAL_DT_ID_COL);
for (int i = 0; i < keys.length; i++) {
Record record = enumTable.getRecord(keys[i]);
DBRecord record = enumTable.getRecord(keys[i]);
if (record.getLongValue(V1_ENUM_SOURCE_ARCHIVE_ID_COL) == sourceID.getValue()) {
return record;
}

View file

@ -98,7 +98,7 @@ abstract class EnumValueDBAdapter {
* @return value record or null
* @throws IOException if IO error occurs
*/
abstract Record getRecord(long valueID) throws IOException;
abstract DBRecord getRecord(long valueID) throws IOException;
/**
* Remove the record for the given enum Value ID.
@ -112,7 +112,7 @@ abstract class EnumValueDBAdapter {
* @param record the new record
* @throws IOException if the database can't be accessed.
*/
abstract void updateRecord(Record record) throws IOException;
abstract void updateRecord(DBRecord record) throws IOException;
/**
* Get enum value record IDs which correspond to specified enum datatype ID

View file

@ -39,12 +39,12 @@ class EnumValueDBAdapterNoTable extends EnumValueDBAdapter {
}
@Override
public Record getRecord(long valueID) throws IOException {
public DBRecord getRecord(long valueID) throws IOException {
return null;
}
@Override
public void updateRecord(Record record) throws IOException {
public void updateRecord(DBRecord record) throws IOException {
throw new UnsupportedOperationException();
}

View file

@ -72,7 +72,7 @@ class EnumValueDBAdapterV0 extends EnumValueDBAdapter {
@Override
public void createRecord(long enumID, String name, long value) throws IOException {
Record record = V0_ENUM_VALUE_SCHEMA.createRecord(valueTable.getKey());
DBRecord record = V0_ENUM_VALUE_SCHEMA.createRecord(valueTable.getKey());
record.setLongValue(V0_ENUMVAL_ID_COL, enumID);
record.setString(V0_ENUMVAL_NAME_COL, name);
record.setLongValue(V0_ENUMVAL_VALUE_COL, value);
@ -80,7 +80,7 @@ class EnumValueDBAdapterV0 extends EnumValueDBAdapter {
}
@Override
public Record getRecord(long valueID) throws IOException {
public DBRecord getRecord(long valueID) throws IOException {
return valueTable.getRecord(valueID);
}
@ -90,7 +90,7 @@ class EnumValueDBAdapterV0 extends EnumValueDBAdapter {
}
@Override
public void updateRecord(Record record) throws IOException {
public void updateRecord(DBRecord record) throws IOException {
valueTable.putRecord(record);
}

View file

@ -19,7 +19,7 @@ import java.io.IOException;
import java.util.*;
import db.Field;
import db.Record;
import db.DBRecord;
import ghidra.docking.settings.Settings;
import ghidra.program.database.DBObjectCache;
import ghidra.program.model.data.*;
@ -38,7 +38,7 @@ class FunctionDefinitionDB extends DataTypeDB implements FunctionDefinition {
FunctionDefinitionDB(DataTypeManagerDB dataMgr, DBObjectCache<DataTypeDB> cache,
FunctionDefinitionDBAdapter adapter, FunctionParameterAdapter paramAdapter,
Record record) {
DBRecord record) {
super(dataMgr, cache, record);
this.funDefAdapter = adapter;
this.paramAdapter = paramAdapter;
@ -60,7 +60,7 @@ class FunctionDefinitionDB extends DataTypeDB implements FunctionDefinition {
try {
Field[] ids = paramAdapter.getParameterIdsInFunctionDef(key);
for (Field id : ids) {
Record rec = paramAdapter.getRecord(id.getLongValue());
DBRecord rec = paramAdapter.getRecord(id.getLongValue());
parameters.add(new ParameterDefinitionDB(dataMgr, paramAdapter, this, rec));
}
Collections.sort(parameters);
@ -73,7 +73,7 @@ class FunctionDefinitionDB extends DataTypeDB implements FunctionDefinition {
@Override
protected boolean refresh() {
try {
Record rec = funDefAdapter.getRecord(key);
DBRecord rec = funDefAdapter.getRecord(key);
if (rec != null) {
record = rec;
loadParameters();

View file

@ -124,7 +124,7 @@ abstract class FunctionDefinitionDBAdapter {
tmpAdapter = new FunctionDefinitionDBAdapterV1(tmpHandle, true);
RecordIterator it = oldAdapter.getRecords();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
tmpAdapter.updateRecord(rec, false);
}
oldAdapter.deleteTable(handle);
@ -132,7 +132,7 @@ abstract class FunctionDefinitionDBAdapter {
new FunctionDefinitionDBAdapterV1(handle, true);
it = tmpAdapter.getRecords();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
newAdapter.updateRecord(rec, false);
}
return newAdapter;
@ -157,7 +157,7 @@ abstract class FunctionDefinitionDBAdapter {
* @return the database record for this data type.
* @throws IOException if the database can't be accessed.
*/
abstract Record createRecord(String name, String comments, long categoryID, long returnDtID,
abstract DBRecord createRecord(String name, String comments, long categoryID, long returnDtID,
boolean hasVarArgs, GenericCallingConvention genericCallingConvention,
long sourceArchiveID, long sourceDataTypeID, long lastChangeTime) throws IOException;
@ -167,7 +167,7 @@ abstract class FunctionDefinitionDBAdapter {
* @return the record for the function definition data type.
* @throws IOException if the database can't be accessed.
*/
abstract Record getRecord(long functionDefID) throws IOException;
abstract DBRecord getRecord(long functionDefID) throws IOException;
/**
* Gets an iterator over all function signature definition data type records.
@ -191,7 +191,7 @@ abstract class FunctionDefinitionDBAdapter {
* current time before putting the record in the database.
* @throws IOException if the database can't be accessed.
*/
abstract void updateRecord(Record record, boolean setLastChangeTime) throws IOException;
abstract void updateRecord(DBRecord record, boolean setLastChangeTime) throws IOException;
/**
* Deletes the function definition data type table from the database with the specified database handle.
@ -224,7 +224,7 @@ abstract class FunctionDefinitionDBAdapter {
* @return function definition record found or null
* @throws IOException if IO error occurs
*/
abstract Record getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID)
abstract DBRecord getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID)
throws IOException;
}

View file

@ -37,7 +37,7 @@ class FunctionDefinitionDBAdapterNoTable extends FunctionDefinitionDBAdapter {
}
@Override
public Record createRecord(String name, String comments, long categoryID, long returnDtID,
public DBRecord createRecord(String name, String comments, long categoryID, long returnDtID,
boolean hasVarArgs, GenericCallingConvention genericCallingConvention,
long sourceArchiveID, long sourceDataTypeID, long lastChangeTime) throws IOException {
throw new UnsupportedOperationException(
@ -45,7 +45,7 @@ class FunctionDefinitionDBAdapterNoTable extends FunctionDefinitionDBAdapter {
}
@Override
public Record getRecord(long functionDefID) throws IOException {
public DBRecord getRecord(long functionDefID) throws IOException {
return null;
}
@ -55,7 +55,7 @@ class FunctionDefinitionDBAdapterNoTable extends FunctionDefinitionDBAdapter {
}
@Override
public void updateRecord(Record record, boolean setLastChangeTime) throws IOException {
public void updateRecord(DBRecord record, boolean setLastChangeTime) throws IOException {
throw new UnsupportedOperationException();
}
@ -80,7 +80,7 @@ class FunctionDefinitionDBAdapterNoTable extends FunctionDefinitionDBAdapter {
}
@Override
Record getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
DBRecord getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
return null;
}

View file

@ -69,7 +69,7 @@ class FunctionDefinitionDBAdapterV0 extends FunctionDefinitionDBAdapter
}
@Override
public Record createRecord(String name, String comments, long categoryID, long returnDtID,
public DBRecord createRecord(String name, String comments, long categoryID, long returnDtID,
boolean hasVarArgs, GenericCallingConvention genericCallingConvention,
long sourceArchiveID, long sourceDataTypeID, long lastChangeTime) throws IOException {
throw new UnsupportedOperationException("Not allowed to update prior version #" + VERSION +
@ -77,7 +77,7 @@ class FunctionDefinitionDBAdapterV0 extends FunctionDefinitionDBAdapter
}
@Override
public Record getRecord(long functionDefID) throws IOException {
public DBRecord getRecord(long functionDefID) throws IOException {
return translateRecord(table.getRecord(functionDefID));
}
@ -87,7 +87,7 @@ class FunctionDefinitionDBAdapterV0 extends FunctionDefinitionDBAdapter
}
@Override
public void updateRecord(Record record, boolean setLastChangeTime) throws IOException {
public void updateRecord(DBRecord record, boolean setLastChangeTime) throws IOException {
throw new UnsupportedOperationException();
}
@ -112,11 +112,11 @@ class FunctionDefinitionDBAdapterV0 extends FunctionDefinitionDBAdapter
}
@Override
public Record translateRecord(Record oldRec) {
public DBRecord translateRecord(DBRecord oldRec) {
if (oldRec == null) {
return null;
}
Record rec = FunctionDefinitionDBAdapter.FUN_DEF_SCHEMA.createRecord(oldRec.getKey());
DBRecord rec = FunctionDefinitionDBAdapter.FUN_DEF_SCHEMA.createRecord(oldRec.getKey());
rec.setString(FUNCTION_DEF_NAME_COL, oldRec.getString(V0_FUNCTION_DEF_NAME_COL));
rec.setString(FUNCTION_DEF_COMMENT_COL, oldRec.getString(V0_FUNCTION_DEF_COMMENT_COL));
rec.setLongValue(FUNCTION_DEF_CAT_ID_COL, oldRec.getLongValue(V0_FUNCTION_DEF_CAT_ID_COL));
@ -131,7 +131,7 @@ class FunctionDefinitionDBAdapterV0 extends FunctionDefinitionDBAdapter
}
@Override
Record getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
DBRecord getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
return null;
}

View file

@ -79,7 +79,7 @@ class FunctionDefinitionDBAdapterV1 extends FunctionDefinitionDBAdapter {
}
@Override
public Record createRecord(String name, String comments, long categoryID, long returnDtID,
public DBRecord createRecord(String name, String comments, long categoryID, long returnDtID,
boolean hasVarArgs, GenericCallingConvention genericCallingConvention,
long sourceArchiveID, long sourceDataTypeID, long lastChangeTime) throws IOException {
byte flags = (byte) 0;
@ -102,7 +102,7 @@ class FunctionDefinitionDBAdapterV1 extends FunctionDefinitionDBAdapter {
// tableKey = DataManager.VOID_DATATYPE_ID +1;
// }
long key = DataTypeManagerDB.createKey(DataTypeManagerDB.FUNCTION_DEF, tableKey);
Record record = V1_FUN_DEF_SCHEMA.createRecord(key);
DBRecord record = V1_FUN_DEF_SCHEMA.createRecord(key);
record.setString(V1_FUNCTION_DEF_NAME_COL, name);
record.setString(V1_FUNCTION_DEF_COMMENT_COL, comments);
@ -118,12 +118,12 @@ class FunctionDefinitionDBAdapterV1 extends FunctionDefinitionDBAdapter {
}
@Override
public Record getRecord(long functionDefID) throws IOException {
public DBRecord getRecord(long functionDefID) throws IOException {
return table.getRecord(functionDefID);
}
@Override
public void updateRecord(Record record, boolean setLastChangeTime) throws IOException {
public void updateRecord(DBRecord record, boolean setLastChangeTime) throws IOException {
if (setLastChangeTime) {
record.setLongValue(FunctionDefinitionDBAdapter.FUNCTION_DEF_LAST_CHANGE_TIME_COL,
(new Date()).getTime());
@ -157,12 +157,12 @@ class FunctionDefinitionDBAdapterV1 extends FunctionDefinitionDBAdapter {
}
@Override
Record getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
DBRecord getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
Field[] keys = table.findRecords(new LongField(datatypeID.getValue()),
V1_FUNCTION_DEF_UNIVERSAL_DT_ID_COL);
for (int i = 0; i < keys.length; i++) {
Record record = table.getRecord(keys[i]);
DBRecord record = table.getRecord(keys[i]);
if (record.getLongValue(V1_FUNCTION_DEF_SOURCE_ARCHIVE_ID_COL) == sourceID.getValue()) {
return record;
}

View file

@ -106,14 +106,14 @@ abstract class FunctionParameterAdapter {
tmpAdapter = new FunctionParameterAdapterV1(tmpHandle, true);
RecordIterator it = oldAdapter.getRecords();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
tmpAdapter.updateRecord(rec);
}
oldAdapter.deleteTable(handle);
FunctionParameterAdapterV1 newAdapter = new FunctionParameterAdapterV1(handle, true);
it = tmpAdapter.getRecords();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
newAdapter.updateRecord(rec);
}
return newAdapter;
@ -149,7 +149,7 @@ abstract class FunctionParameterAdapter {
* @return new record
* @throws IOException if IO error occurs
*/
abstract Record createRecord(long dataTypeID, long parentID, int ordinal, String name,
abstract DBRecord createRecord(long dataTypeID, long parentID, int ordinal, String name,
String comment, int dtLength) throws IOException;
/**
@ -158,14 +158,14 @@ abstract class FunctionParameterAdapter {
* @return parameter definition record or null
* @throws IOException if IO error occurs
*/
abstract Record getRecord(long parameterID) throws IOException;
abstract DBRecord getRecord(long parameterID) throws IOException;
/**
* Updates the function definition parameter data type table with the provided record.
* @param record the new record
* @throws IOException if the database can't be accessed.
*/
abstract void updateRecord(Record record) throws IOException;
abstract void updateRecord(DBRecord record) throws IOException;
/**
* Removes the function definition parameter data type record with the specified ID.

View file

@ -38,13 +38,13 @@ class FunctionParameterAdapterNoTable extends FunctionParameterAdapter {
}
@Override
public Record createRecord(long dataTypeID, long parentID, int ordinal, String name,
public DBRecord createRecord(long dataTypeID, long parentID, int ordinal, String name,
String comment, int dtLength) throws IOException {
return null;
}
@Override
public Record getRecord(long parameterID) throws IOException {
public DBRecord getRecord(long parameterID) throws IOException {
return null;
}
@ -54,7 +54,7 @@ class FunctionParameterAdapterNoTable extends FunctionParameterAdapter {
}
@Override
public void updateRecord(Record record) throws IOException {
public void updateRecord(DBRecord record) throws IOException {
throw new UnsupportedOperationException();
}

View file

@ -64,7 +64,7 @@ class FunctionParameterAdapterV0 extends FunctionParameterAdapter implements Rec
}
@Override
public Record createRecord(long dataTypeID, long parentID, int ordinal, String name,
public DBRecord createRecord(long dataTypeID, long parentID, int ordinal, String name,
String comment, int dtLength) throws IOException {
long tableKey = parameterTable.getKey();
@ -72,7 +72,7 @@ class FunctionParameterAdapterV0 extends FunctionParameterAdapter implements Rec
// tableKey = DataManager.VOID_DATATYPE_ID +1;
// }
long key = DataTypeManagerDB.createKey(DataTypeManagerDB.PARAMETER, tableKey);
Record record = V0_PARAMETER_SCHEMA.createRecord(key);
DBRecord record = V0_PARAMETER_SCHEMA.createRecord(key);
record.setLongValue(V0_PARAMETER_PARENT_ID_COL, parentID);
record.setLongValue(V0_PARAMETER_DT_ID_COL, dataTypeID);
record.setString(V0_PARAMETER_NAME_COL, name);
@ -83,7 +83,7 @@ class FunctionParameterAdapterV0 extends FunctionParameterAdapter implements Rec
}
@Override
public Record getRecord(long parameterID) throws IOException {
public DBRecord getRecord(long parameterID) throws IOException {
return translateRecord(parameterTable.getRecord(parameterID));
}
@ -93,7 +93,7 @@ class FunctionParameterAdapterV0 extends FunctionParameterAdapter implements Rec
}
@Override
public void updateRecord(Record record) throws IOException {
public void updateRecord(DBRecord record) throws IOException {
throw new UnsupportedOperationException();
}
@ -116,11 +116,11 @@ class FunctionParameterAdapterV0 extends FunctionParameterAdapter implements Rec
* @see db.RecordTranslator#translateRecord(db.Record)
*/
@Override
public Record translateRecord(Record oldRec) {
public DBRecord translateRecord(DBRecord oldRec) {
if (oldRec == null) {
return null;
}
Record rec = FunctionParameterAdapter.PARAMETER_SCHEMA.createRecord(oldRec.getKey());
DBRecord rec = FunctionParameterAdapter.PARAMETER_SCHEMA.createRecord(oldRec.getKey());
rec.setLongValue(FunctionParameterAdapter.PARAMETER_PARENT_ID_COL,
oldRec.getLongValue(V0_PARAMETER_PARENT_ID_COL));
rec.setLongValue(FunctionParameterAdapter.PARAMETER_DT_ID_COL,

View file

@ -74,7 +74,7 @@ class FunctionParameterAdapterV1 extends FunctionParameterAdapter {
}
@Override
public Record createRecord(long dataTypeID, long parentID, int ordinal, String name,
public DBRecord createRecord(long dataTypeID, long parentID, int ordinal, String name,
String comment, int dtLength) throws IOException {
long tableKey = table.getKey();
@ -82,7 +82,7 @@ class FunctionParameterAdapterV1 extends FunctionParameterAdapter {
// tableKey = DataManager.VOID_DATATYPE_ID +1;
// }
long key = DataTypeManagerDB.createKey(DataTypeManagerDB.PARAMETER, tableKey);
Record record = V1_PARAMETER_SCHEMA.createRecord(key);
DBRecord record = V1_PARAMETER_SCHEMA.createRecord(key);
record.setLongValue(V1_PARAMETER_PARENT_ID_COL, parentID);
record.setLongValue(V1_PARAMETER_DT_ID_COL, dataTypeID);
record.setString(V1_PARAMETER_NAME_COL, name);
@ -94,7 +94,7 @@ class FunctionParameterAdapterV1 extends FunctionParameterAdapter {
}
@Override
public Record getRecord(long parameterID) throws IOException {
public DBRecord getRecord(long parameterID) throws IOException {
return table.getRecord(parameterID);
}
@ -104,7 +104,7 @@ class FunctionParameterAdapterV1 extends FunctionParameterAdapter {
}
@Override
public void updateRecord(Record record) throws IOException {
public void updateRecord(DBRecord record) throws IOException {
table.putRecord(record);
}

View file

@ -93,7 +93,7 @@ abstract class InstanceSettingsDBAdapter {
if (monitor.isCancelled()) {
throw new CancelledException();
}
Record rec = iter.next();
DBRecord rec = iter.next();
Address addr = oldAddrMap.decodeAddress(rec.getLongValue(INST_ADDR_COL));
rec.setLongValue(INST_ADDR_COL, addrMap.getKey(addr, true));
tmpAdapter.updateInstanceRecord(rec);
@ -107,7 +107,7 @@ abstract class InstanceSettingsDBAdapter {
if (monitor.isCancelled()) {
throw new CancelledException();
}
Record rec = iter.next();
DBRecord rec = iter.next();
newAdapter.updateInstanceRecord(rec);
monitor.setProgress(++cnt);
}
@ -133,7 +133,7 @@ abstract class InstanceSettingsDBAdapter {
* @return
* @throws IOException if there was a problem accessing the database
*/
abstract Record createInstanceRecord(long addr, String name, String strValue, long longValue,
abstract DBRecord createInstanceRecord(long addr, String name, String strValue, long longValue,
byte[] byteValue) throws IOException;
/**
@ -155,13 +155,13 @@ abstract class InstanceSettingsDBAdapter {
* @param settingsID key for the record
* @throws IOException if there was a problem accessing the database
*/
abstract Record getInstanceRecord(long settingsID) throws IOException;
abstract DBRecord getInstanceRecord(long settingsID) throws IOException;
/**
* Update the instance settings record in the table.
* @throws IOException if there was a problem accessing the database
*/
abstract void updateInstanceRecord(Record record) throws IOException;
abstract void updateInstanceRecord(DBRecord record) throws IOException;
/**
* Get an iterator over those records that fall in the given range for

View file

@ -65,10 +65,10 @@ class InstanceSettingsDBAdapterV0 extends InstanceSettingsDBAdapter {
}
@Override
public Record createInstanceRecord(long addr, String name, String strValue, long longValue,
public DBRecord createInstanceRecord(long addr, String name, String strValue, long longValue,
byte[] byteValue) throws IOException {
Record record = V0_INSTANCE_SCHEMA.createRecord(instanceTable.getKey());
DBRecord record = V0_INSTANCE_SCHEMA.createRecord(instanceTable.getKey());
record.setLongValue(V0_INST_ADDR_COL, addr);
record.setString(V0_INST_NAME_COL, name);
record.setString(V0_INST_STRING_VALUE_COL, strValue);
@ -89,12 +89,12 @@ class InstanceSettingsDBAdapterV0 extends InstanceSettingsDBAdapter {
}
@Override
public Record getInstanceRecord(long settingsID) throws IOException {
public DBRecord getInstanceRecord(long settingsID) throws IOException {
return instanceTable.getRecord(settingsID);
}
@Override
public void updateInstanceRecord(Record record) throws IOException {
public void updateInstanceRecord(DBRecord record) throws IOException {
instanceTable.putRecord(record);
}

View file

@ -20,7 +20,7 @@ package ghidra.program.database.data;
import java.io.IOException;
import db.Record;
import db.DBRecord;
import ghidra.program.model.data.*;
import ghidra.program.model.listing.Parameter;
import ghidra.program.model.listing.Variable;
@ -32,19 +32,19 @@ import ghidra.program.model.symbol.SymbolUtilities;
final class ParameterDefinitionDB implements ParameterDefinition {
private DataTypeManagerDB dataMgr;
private Record record;
private DBRecord record;
private FunctionDefinitionDB parent;
private FunctionParameterAdapter adapter;
ParameterDefinitionDB(DataTypeManagerDB dataMgr, FunctionParameterAdapter adapter,
FunctionDefinitionDB parent, Record record) {
FunctionDefinitionDB parent, DBRecord record) {
this.dataMgr = dataMgr;
this.parent = parent;
this.adapter = adapter;
this.record = record;
}
Record getRecord() {
DBRecord getRecord() {
return record;
}

View file

@ -53,7 +53,7 @@ class ParentChildDBAdapterV0 extends ParentChildAdapter {
@Override
public void createRecord(long parentID, long childID) throws IOException {
long key = table.getKey();
Record record = V0_SCHEMA.createRecord(key);
DBRecord record = V0_SCHEMA.createRecord(key);
record.setLongValue(PARENT_COL, parentID);
record.setLongValue(CHILD_COL, childID);
table.putRecord(record);
@ -64,7 +64,7 @@ class ParentChildDBAdapterV0 extends ParentChildAdapter {
Field[] ids = table.findRecords(new LongField(childID), CHILD_COL);
for (Field id : ids) {
Record rec = table.getRecord(id);
DBRecord rec = table.getRecord(id);
if (rec.getLongValue(PARENT_COL) == parentID) {
table.deleteRecord(id);
return;
@ -77,7 +77,7 @@ class ParentChildDBAdapterV0 extends ParentChildAdapter {
Field[] ids = table.findRecords(new LongField(childID), CHILD_COL);
long[] parentIds = new long[ids.length];
for (int i = 0; i < ids.length; i++) {
Record rec = table.getRecord(ids[i]);
DBRecord rec = table.getRecord(ids[i]);
parentIds[i] = rec.getLongValue(PARENT_COL);
}
return parentIds;

View file

@ -17,7 +17,7 @@ package ghidra.program.database.data;
import java.io.IOException;
import db.Record;
import db.DBRecord;
import ghidra.docking.settings.Settings;
import ghidra.docking.settings.SettingsDefinition;
import ghidra.program.database.DBObjectCache;
@ -55,7 +55,7 @@ class PointerDB extends DataTypeDB implements Pointer {
* @param record
*/
public PointerDB(DataTypeManagerDB dataMgr, DBObjectCache<DataTypeDB> cache,
PointerDBAdapter adapter, Record record) {
PointerDBAdapter adapter, DBRecord record) {
super(dataMgr, cache, record);
this.adapter = adapter;
}
@ -108,7 +108,7 @@ class PointerDB extends DataTypeDB implements Pointer {
@Override
protected boolean refresh() {
try {
Record rec = adapter.getRecord(key);
DBRecord rec = adapter.getRecord(key);
if (rec != null) {
record = rec;
return super.refresh();

View file

@ -77,14 +77,14 @@ abstract class PointerDBAdapter {
tmpAdapter = new PointerDBAdapterV2(tmpHandle, true);
RecordIterator it = oldAdapter.getRecords();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
tmpAdapter.updateRecord(rec);
}
oldAdapter.deleteTable(handle);
PointerDBAdapter newAdapter = new PointerDBAdapterV2(handle, true);
it = tmpAdapter.getRecords();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
newAdapter.updateRecord(rec);
}
return newAdapter;
@ -107,7 +107,7 @@ abstract class PointerDBAdapter {
* @param length pointer size in bytes
* @throws IOException if there was a problem accessing the database
*/
abstract Record createRecord(long dataTypeID, long categoryID, int length) throws IOException;
abstract DBRecord createRecord(long dataTypeID, long categoryID, int length) throws IOException;
/**
* Get the record with the given pointerID.
@ -115,7 +115,7 @@ abstract class PointerDBAdapter {
* @return requested pointer record or null if not found
* @throws IOException if there was a problem accessing the database
*/
abstract Record getRecord(long pointerID) throws IOException;
abstract DBRecord getRecord(long pointerID) throws IOException;
abstract RecordIterator getRecords() throws IOException;
@ -132,7 +132,7 @@ abstract class PointerDBAdapter {
* @param record pointer record to be updated
* @throws IOException if there was a problem accessing the database
*/
abstract void updateRecord(Record record) throws IOException;
abstract void updateRecord(DBRecord record) throws IOException;
/**
* Gets all the pointer data types that are contained in the category that
@ -143,7 +143,7 @@ abstract class PointerDBAdapter {
*/
abstract Field[] getRecordIdsInCategory(long categoryID) throws IOException;
Record translateRecord(Record rec) {
DBRecord translateRecord(DBRecord rec) {
return rec;
}
@ -170,14 +170,14 @@ abstract class PointerDBAdapter {
}
@Override
public Record next() throws IOException {
Record rec = it.next();
public DBRecord next() throws IOException {
DBRecord rec = it.next();
return translateRecord(rec);
}
@Override
public Record previous() throws IOException {
Record rec = it.previous();
public DBRecord previous() throws IOException {
DBRecord rec = it.previous();
return translateRecord(rec);
}
}

View file

@ -49,12 +49,12 @@ class PointerDBAdapterV0 extends PointerDBAdapter {
}
@Override
Record createRecord(long dataTypeID, long categoryID, int length) throws IOException {
DBRecord createRecord(long dataTypeID, long categoryID, int length) throws IOException {
throw new UnsupportedOperationException("Cannot update Version 0");
}
@Override
Record getRecord(long pointerID) throws IOException {
DBRecord getRecord(long pointerID) throws IOException {
return translateRecord(table.getRecord(pointerID));
}
@ -69,7 +69,7 @@ class PointerDBAdapterV0 extends PointerDBAdapter {
}
@Override
void updateRecord(Record record) throws IOException {
void updateRecord(DBRecord record) throws IOException {
throw new UnsupportedOperationException("Cannot update Version 0");
}
@ -79,11 +79,11 @@ class PointerDBAdapterV0 extends PointerDBAdapter {
}
@Override
Record translateRecord(Record oldRec) {
DBRecord translateRecord(DBRecord oldRec) {
if (oldRec == null) {
return null;
}
Record rec = PointerDBAdapter.SCHEMA.createRecord(oldRec.getKey());
DBRecord rec = PointerDBAdapter.SCHEMA.createRecord(oldRec.getKey());
rec.setLongValue(PTR_DT_ID_COL, oldRec.getLongValue(OLD_PTR_DTD_COL));
rec.setLongValue(PTR_CATEGORY_COL, 0);
return rec;

View file

@ -49,11 +49,11 @@ class PointerDBAdapterV1 extends PointerDBAdapter {
}
@Override
Record translateRecord(Record oldRec) {
DBRecord translateRecord(DBRecord oldRec) {
if (oldRec == null) {
return null;
}
Record rec = PointerDBAdapter.SCHEMA.createRecord(oldRec.getKey());
DBRecord rec = PointerDBAdapter.SCHEMA.createRecord(oldRec.getKey());
rec.setLongValue(PTR_DT_ID_COL, oldRec.getLongValue(OLD_PTR_DT_ID_COL));
rec.setLongValue(PTR_CATEGORY_COL, oldRec.getLongValue(OLD_PTR_CATEGORY_COL));
rec.setByteValue(PTR_LENGTH_COL, (byte) -1);
@ -61,12 +61,12 @@ class PointerDBAdapterV1 extends PointerDBAdapter {
}
@Override
Record createRecord(long dataTypeID, long categoryID, int length) throws IOException {
DBRecord createRecord(long dataTypeID, long categoryID, int length) throws IOException {
throw new UnsupportedOperationException();
}
@Override
Record getRecord(long pointerID) throws IOException {
DBRecord getRecord(long pointerID) throws IOException {
return translateRecord(table.getRecord(pointerID));
}
@ -81,7 +81,7 @@ class PointerDBAdapterV1 extends PointerDBAdapter {
}
@Override
void updateRecord(Record record) throws IOException {
void updateRecord(DBRecord record) throws IOException {
throw new UnsupportedOperationException();
}

View file

@ -46,11 +46,11 @@ class PointerDBAdapterV2 extends PointerDBAdapter {
}
@Override
Record createRecord(long dataTypeID, long categoryID, int length) throws IOException {
DBRecord createRecord(long dataTypeID, long categoryID, int length) throws IOException {
long tableKey = table.getKey();
long key = DataTypeManagerDB.createKey(DataTypeManagerDB.POINTER, tableKey);
Record record = SCHEMA.createRecord(key);
DBRecord record = SCHEMA.createRecord(key);
record.setLongValue(PTR_DT_ID_COL, dataTypeID);
record.setLongValue(PTR_CATEGORY_COL, categoryID);
record.setByteValue(PTR_LENGTH_COL, (byte) length);
@ -59,7 +59,7 @@ class PointerDBAdapterV2 extends PointerDBAdapter {
}
@Override
Record getRecord(long pointerID) throws IOException {
DBRecord getRecord(long pointerID) throws IOException {
return table.getRecord(pointerID);
}
@ -74,7 +74,7 @@ class PointerDBAdapterV2 extends PointerDBAdapter {
}
@Override
void updateRecord(Record record) throws IOException {
void updateRecord(DBRecord record) throws IOException {
table.putRecord(record);
}

View file

@ -15,7 +15,7 @@
*/
package ghidra.program.database.data;
import db.Record;
import db.DBRecord;
/**
* DatabaseObject for a Default settings record.
@ -23,14 +23,14 @@ import db.Record;
*
*/
class SettingsDB {
private Record record;
private DBRecord record;
/**
* Constructor
* @param cache
* @param record
*/
SettingsDB(Record record) {
SettingsDB(DBRecord record) {
this.record = record;
}

View file

@ -60,7 +60,7 @@ abstract class SettingsDBAdapter {
* @return new record
* @throws IOException if there was a problem accessing the database
*/
abstract Record createSettingsRecord(long dataTypeID, String name, String strValue,
abstract DBRecord createSettingsRecord(long dataTypeID, String name, String strValue,
long longValue, byte[] byteValue) throws IOException;
/**
@ -86,13 +86,13 @@ abstract class SettingsDBAdapter {
* @return record corresponding to settingsID or null
* @throws IOException if there was a problem accessing the database
*/
abstract Record getSettingsRecord(long settingsID) throws IOException;
abstract DBRecord getSettingsRecord(long settingsID) throws IOException;
/**
* Update the default settings record in the table.
* @param record the new record
* @throws IOException if there was a problem accessing the database
*/
abstract void updateSettingsRecord(Record record) throws IOException;
abstract void updateSettingsRecord(DBRecord record) throws IOException;
}

View file

@ -58,10 +58,10 @@ class SettingsDBAdapterV0 extends SettingsDBAdapter {
}
@Override
public Record createSettingsRecord(long dataTypeID, String name, String strValue,
public DBRecord createSettingsRecord(long dataTypeID, String name, String strValue,
long longValue, byte[] byteValue) throws IOException {
Record record = V0_SETTINGS_SCHEMA.createRecord(settingsTable.getKey());
DBRecord record = V0_SETTINGS_SCHEMA.createRecord(settingsTable.getKey());
record.setLongValue(V0_SETTINGS_DT_ID_COL, dataTypeID);
record.setString(V0_SETTINGS_NAME_COL, name);
record.setString(V0_SETTINGS_STRING_VALUE_COL, strValue);
@ -82,12 +82,12 @@ class SettingsDBAdapterV0 extends SettingsDBAdapter {
}
@Override
public Record getSettingsRecord(long settingsID) throws IOException {
public DBRecord getSettingsRecord(long settingsID) throws IOException {
return settingsTable.getRecord(settingsID);
}
@Override
public void updateSettingsRecord(Record record) throws IOException {
public void updateSettingsRecord(DBRecord record) throws IOException {
settingsTable.putRecord(record);
}

View file

@ -19,7 +19,7 @@ import java.io.IOException;
import java.util.*;
import db.Field;
import db.Record;
import db.DBRecord;
import ghidra.docking.settings.Settings;
import ghidra.program.model.data.DataType;
import ghidra.program.model.data.DataTypeComponent;
@ -179,7 +179,7 @@ class SettingsDBManager implements Settings {
try {
Field[] keys = adapter.getSettingsKeys(dataTypeID);
for (int i = 0; i < keys.length; i++) {
Record rec = adapter.getSettingsRecord(keys[i].getLongValue());
DBRecord rec = adapter.getSettingsRecord(keys[i].getLongValue());
String settingsName = rec.getString(SettingsDBAdapter.SETTINGS_NAME_COL);
if (settingsName.equals(name)) {
adapter.removeSettingsRecord(keys[i].getLongValue());
@ -213,7 +213,7 @@ class SettingsDBManager implements Settings {
try {
Field[] keys = adapter.getSettingsKeys(dataTypeID);
for (int i = 0; i < keys.length; i++) {
Record rec = adapter.getSettingsRecord(keys[i].getLongValue());
DBRecord rec = adapter.getSettingsRecord(keys[i].getLongValue());
String name = rec.getString(SettingsDBAdapter.SETTINGS_NAME_COL);
if (!list.contains(name)) {
list.add(name);
@ -275,11 +275,11 @@ class SettingsDBManager implements Settings {
return oldLongValue != newLongValue;
}
private Record getRecord(String name) {
private DBRecord getRecord(String name) {
try {
Field[] keys = adapter.getSettingsKeys(dataTypeID);
for (int i = 0; i < keys.length; i++) {
Record rec = adapter.getSettingsRecord(keys[i].getLongValue());
DBRecord rec = adapter.getSettingsRecord(keys[i].getLongValue());
if (rec.getString(SettingsDBAdapter.SETTINGS_NAME_COL).equals(name)) {
return rec;
}
@ -294,7 +294,7 @@ class SettingsDBManager implements Settings {
private SettingsDB getSettingsDB(String name) {
Record record = getRecord(name);
DBRecord record = getRecord(name);
if (record != null) {
return new SettingsDB(record);
}
@ -305,7 +305,7 @@ class SettingsDBManager implements Settings {
byte[] byteValue) throws IOException {
boolean wasChanged = false;
Record record = getRecord(name);
DBRecord record = getRecord(name);
if (record == null) {
wasChanged = true;
record = adapter.createSettingsRecord(dataTypeID, name, strValue, longValue, byteValue);

View file

@ -104,16 +104,16 @@ abstract class SourceArchiveAdapter {
SourceArchiveAdapter tmpAdapter = null;
try {
tmpAdapter = new SourceArchiveAdapterV0(tmpHandle, true);
Iterator<Record> it = oldAdapter.getRecords().iterator();
Iterator<DBRecord> it = oldAdapter.getRecords().iterator();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
tmpAdapter.updateRecord(rec);
}
oldAdapter.deleteTable(handle);
SourceArchiveAdapter newAdapter = new SourceArchiveAdapterV0(handle, true);
it = tmpAdapter.getRecords().iterator();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
newAdapter.updateRecord(rec);
}
@ -131,25 +131,25 @@ abstract class SourceArchiveAdapter {
* Creates a new source archive record using the information from the given source archive.
* @param sourceArchive the source archive from which to get the archive information.
*/
abstract Record createRecord(SourceArchive sourceArchive) throws IOException;
abstract DBRecord createRecord(SourceArchive sourceArchive) throws IOException;
/**
* Returns a list containing all records in the archive table
* @return
*/
abstract List<Record> getRecords() throws IOException;
abstract List<DBRecord> getRecords() throws IOException;
/**
* Returns the record for the given key (sourceArchiveID)
*/
abstract Record getRecord(long key) throws IOException;
abstract DBRecord getRecord(long key) throws IOException;
/**
* Updates the data type archive ID table with the provided record.
* @param record the new record
* @throws IOException if the database can't be accessed.
*/
abstract void updateRecord(Record record) throws IOException;
abstract void updateRecord(DBRecord record) throws IOException;
/**
* Remove the record for the given data type archive ID.

View file

@ -25,14 +25,14 @@ import java.util.ArrayList;
import java.util.List;
import db.DBHandle;
import db.Record;
import db.DBRecord;
/**
* Adapter needed for a read-only version of data type manager that is not going
* to be upgraded, and there is no Data Type Archive ID table in the data type manager.
*/
class SourceArchiveAdapterNoTable extends SourceArchiveAdapter {
private static Record LOCAL_RECORD;
private static DBRecord LOCAL_RECORD;
static {
LOCAL_RECORD = SCHEMA.createRecord(DataTypeManager.LOCAL_ARCHIVE_KEY);
@ -53,7 +53,7 @@ class SourceArchiveAdapterNoTable extends SourceArchiveAdapter {
}
@Override
Record createRecord(SourceArchive sourceArchive) throws IOException {
DBRecord createRecord(SourceArchive sourceArchive) throws IOException {
throw new UnsupportedOperationException(
"Not allowed to update version prior to existence of the Data Type Archive ID table.");
}
@ -63,7 +63,7 @@ class SourceArchiveAdapterNoTable extends SourceArchiveAdapter {
}
@Override
Record getRecord(long key) throws IOException {
DBRecord getRecord(long key) throws IOException {
if (key == DataTypeManager.LOCAL_ARCHIVE_KEY) {
return LOCAL_RECORD;
}
@ -71,8 +71,8 @@ class SourceArchiveAdapterNoTable extends SourceArchiveAdapter {
}
@Override
List<Record> getRecords() {
List<Record> records = new ArrayList<Record>();
List<DBRecord> getRecords() {
List<DBRecord> records = new ArrayList<DBRecord>();
records.add(LOCAL_RECORD);
return records;
}
@ -83,7 +83,7 @@ class SourceArchiveAdapterNoTable extends SourceArchiveAdapter {
}
@Override
void updateRecord(Record record) throws IOException {
void updateRecord(DBRecord record) throws IOException {
throw new UnsupportedOperationException("updateRecord not supported");
}

View file

@ -79,14 +79,14 @@ class SourceArchiveAdapterV0 extends SourceArchiveAdapter {
* @throws IOException
*/
private void createRecordForLocalManager() throws IOException {
Record record = V0_SCHEMA.createRecord(DataTypeManager.LOCAL_ARCHIVE_KEY);
DBRecord record = V0_SCHEMA.createRecord(DataTypeManager.LOCAL_ARCHIVE_KEY);
record.setLongValue(V0_ARCHIVE_ID_LAST_SYNC_TIME_COL, (new Date()).getTime());
table.putRecord(record);
}
@Override
public Record createRecord(SourceArchive archive) throws IOException {
Record record = V0_SCHEMA.createRecord(archive.getSourceArchiveID().getValue());
public DBRecord createRecord(SourceArchive archive) throws IOException {
DBRecord record = V0_SCHEMA.createRecord(archive.getSourceArchiveID().getValue());
record.setString(V0_ARCHIVE_ID_DOMAIN_FILE_ID_COL, archive.getDomainFileID());
record.setString(V0_ARCHIVE_ID_NAME_COL, archive.getName());
record.setByteValue(V0_ARCHIVE_ID_TYPE_COL, (byte) archive.getArchiveType().ordinal());
@ -103,13 +103,13 @@ class SourceArchiveAdapterV0 extends SourceArchiveAdapter {
}
@Override
public Record getRecord(long key) throws IOException {
public DBRecord getRecord(long key) throws IOException {
return table.getRecord(key);
}
@Override
public List<Record> getRecords() throws IOException {
List<Record> records = new ArrayList<>();
public List<DBRecord> getRecords() throws IOException {
List<DBRecord> records = new ArrayList<>();
RecordIterator iterator = table.iterator();
while (iterator.hasNext()) {
records.add(iterator.next());
@ -118,7 +118,7 @@ class SourceArchiveAdapterV0 extends SourceArchiveAdapter {
}
@Override
public void updateRecord(Record record) throws IOException {
public void updateRecord(DBRecord record) throws IOException {
table.putRecord(record);
}

View file

@ -17,7 +17,7 @@ package ghidra.program.database.data;
import java.io.IOException;
import db.Record;
import db.DBRecord;
import ghidra.program.database.DBObjectCache;
import ghidra.program.database.DatabaseObject;
import ghidra.program.model.data.*;
@ -26,13 +26,13 @@ import ghidra.util.UniversalID;
public class SourceArchiveDB extends DatabaseObject implements SourceArchive {
private UniversalID sourceID;
private Record record;
private DBRecord record;
private final SourceArchiveAdapter adapter;
private final DataTypeManagerDB dtMgr;
private Lock lock;
public SourceArchiveDB(DataTypeManagerDB dtMgr, DBObjectCache<SourceArchiveDB> cache,
SourceArchiveAdapter adapter, Record record) {
SourceArchiveAdapter adapter, DBRecord record) {
super(cache, record.getKey());
this.dtMgr = dtMgr;
this.adapter = adapter;
@ -97,7 +97,7 @@ public class SourceArchiveDB extends DatabaseObject implements SourceArchive {
@Override
protected boolean refresh() {
try {
Record rec = adapter.getRecord(key);
DBRecord rec = adapter.getRecord(key);
if (rec != null) {
record = rec;
return true;

View file

@ -19,7 +19,7 @@ import java.io.IOException;
import java.util.*;
import db.Field;
import db.Record;
import db.DBRecord;
import ghidra.docking.settings.Settings;
import ghidra.program.database.DBObjectCache;
import ghidra.program.model.data.*;
@ -56,7 +56,7 @@ class StructureDB extends CompositeDB implements Structure {
*/
public StructureDB(DataTypeManagerDB dataMgr, DBObjectCache<DataTypeDB> cache,
CompositeDBAdapter compositeAdapter, ComponentDBAdapter componentAdapter,
Record record) {
DBRecord record) {
super(dataMgr, cache, compositeAdapter, componentAdapter, record);
}
@ -68,7 +68,7 @@ class StructureDB extends CompositeDB implements Structure {
try {
Field[] ids = componentAdapter.getComponentIdsInComposite(key);
for (Field id : ids) {
Record rec = componentAdapter.getRecord(id.getLongValue());
DBRecord rec = componentAdapter.getRecord(id.getLongValue());
DataTypeComponentDB component =
new DataTypeComponentDB(dataMgr, componentAdapter, this, rec);
if (component.isFlexibleArrayComponent()) {
@ -129,7 +129,7 @@ class StructureDB extends CompositeDB implements Structure {
}
else {
int componentLength = getPreferredComponentLength(dataType, length);
Record rec = componentAdapter.createRecord(dataMgr.getResolvedID(dataType), key,
DBRecord rec = componentAdapter.createRecord(dataMgr.getResolvedID(dataType), key,
componentLength, numComponents, structLength, name, comment);
dtc = new DataTypeComponentDB(dataMgr, componentAdapter, this, rec);
dataType.addParent(this);
@ -193,7 +193,7 @@ class StructureDB extends CompositeDB implements Structure {
flexibleArrayComponent = null;
}
Record rec = componentAdapter.createRecord(dataMgr.getResolvedID(dataType), key, 0,
DBRecord rec = componentAdapter.createRecord(dataMgr.getResolvedID(dataType), key, 0,
-1, -1, name, comment);
dtc = new DataTypeComponentDB(dataMgr, componentAdapter, this, rec);
dataType.addParent(this);
@ -300,7 +300,7 @@ class StructureDB extends CompositeDB implements Structure {
length = getPreferredComponentLength(dataType, length);
int offset = getComponent(ordinal).getOffset();
Record rec = componentAdapter.createRecord(dataMgr.getResolvedID(dataType), key, length,
DBRecord rec = componentAdapter.createRecord(dataMgr.getResolvedID(dataType), key, length,
ordinal, offset, name, comment);
DataTypeComponentDB dtc = new DataTypeComponentDB(dataMgr, componentAdapter, this, rec);
dataType.addParent(this);
@ -474,7 +474,7 @@ class StructureDB extends CompositeDB implements Structure {
BitFieldDataType bitfieldDt =
new BitFieldDBDataType(baseDataType, bitSize, storageBitOffset);
Record rec = componentAdapter.createRecord(dataMgr.getResolvedID(bitfieldDt), key,
DBRecord rec = componentAdapter.createRecord(dataMgr.getResolvedID(bitfieldDt), key,
bitfieldDt.getStorageSize(), ordinal, revisedOffset, componentName, comment);
DataTypeComponentDB dtc = new DataTypeComponentDB(dataMgr, componentAdapter, this, rec);
bitfieldDt.addParent(this); // has no affect
@ -1016,7 +1016,7 @@ class StructureDB extends CompositeDB implements Structure {
length = getPreferredComponentLength(dataType, length);
Record rec = componentAdapter.createRecord(dataMgr.getResolvedID(dataType), key, length,
DBRecord rec = componentAdapter.createRecord(dataMgr.getResolvedID(dataType), key, length,
ordinal, offset, name, comment);
dataType.addParent(this);
DataTypeComponentDB dtc = new DataTypeComponentDB(dataMgr, componentAdapter, this, rec);
@ -1301,7 +1301,7 @@ class StructureDB extends CompositeDB implements Structure {
length = Math.min(length, maxOffset - dtc.getOffset());
}
Record rec = componentAdapter.createRecord(dataMgr.getResolvedID(dt), key, length,
DBRecord rec = componentAdapter.createRecord(dataMgr.getResolvedID(dt), key, length,
dtc.getOrdinal(), dtc.getOffset(), dtc.getFieldName(), dtc.getComment());
dt.addParent(this);
DataTypeComponentDB newDtc =
@ -1671,7 +1671,7 @@ class StructureDB extends CompositeDB implements Structure {
}
}
}
Record rec = componentAdapter.createRecord(dataMgr.getResolvedID(resolvedDataType), key,
DBRecord rec = componentAdapter.createRecord(dataMgr.getResolvedID(resolvedDataType), key,
length, ordinal, newOffset, name, comment);
resolvedDataType.addParent(this);
DataTypeComponentDB newDtc =

View file

@ -17,7 +17,7 @@ package ghidra.program.database.data;
import java.io.IOException;
import db.Record;
import db.DBRecord;
import ghidra.docking.settings.Settings;
import ghidra.docking.settings.SettingsDefinition;
import ghidra.program.database.DBObjectCache;
@ -40,7 +40,7 @@ class TypedefDB extends DataTypeDB implements TypeDef {
* @param key
*/
public TypedefDB(DataTypeManagerDB dataMgr, DBObjectCache<DataTypeDB> cache,
TypedefDBAdapter adapter, Record record) {
TypedefDBAdapter adapter, DBRecord record) {
super(dataMgr, cache, record);
this.adapter = adapter;
}
@ -236,7 +236,7 @@ class TypedefDB extends DataTypeDB implements TypeDef {
@Override
protected boolean refresh() {
try {
Record rec = adapter.getRecord(key);
DBRecord rec = adapter.getRecord(key);
if (rec != null) {
record = rec;
// super.getDefaultSettings(); // not sure why it was doing this - no one else does.

View file

@ -98,14 +98,14 @@ abstract class TypedefDBAdapter {
tmpAdapter = new TypedefDBAdapterV1(tmpHandle, true);
RecordIterator it = oldAdapter.getRecords();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
tmpAdapter.updateRecord(rec, false);
}
oldAdapter.deleteTable(handle);
TypedefDBAdapter newAdapter = new TypedefDBAdapterV1(handle, true);
it = tmpAdapter.getRecords();
while (it.hasNext()) {
Record rec = it.next();
DBRecord rec = it.next();
newAdapter.updateRecord(rec, false);
}
return newAdapter;
@ -127,7 +127,7 @@ abstract class TypedefDBAdapter {
* @return the database record for this data type.
* @throws IOException if the database can't be accessed.
*/
abstract Record createRecord(long dataTypeID, String name, long categoryID,
abstract DBRecord createRecord(long dataTypeID, String name, long categoryID,
long sourceArchiveID, long sourceDataTypeID, long lastChangeTime) throws IOException;
/**
@ -136,7 +136,7 @@ abstract class TypedefDBAdapter {
* @return the record for the type definition data type.
* @throws IOException if the database can't be accessed.
*/
abstract Record getRecord(long typedefID) throws IOException;
abstract DBRecord getRecord(long typedefID) throws IOException;
/**
* Gets an iterator over all type definition data type records.
@ -160,7 +160,7 @@ abstract class TypedefDBAdapter {
* current time before putting the record in the database.
* @throws IOException if the database can't be accessed.
*/
abstract void updateRecord(Record record, boolean setLastChangeTime) throws IOException;
abstract void updateRecord(DBRecord record, boolean setLastChangeTime) throws IOException;
/**
* Deletes the type definition data type table from the database with the specified database handle.
@ -193,7 +193,7 @@ abstract class TypedefDBAdapter {
* @return typedef record found or null
* @throws IOException if IO error occurs
*/
abstract Record getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID)
abstract DBRecord getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID)
throws IOException;
}

View file

@ -68,14 +68,14 @@ class TypedefDBAdapterV0 extends TypedefDBAdapter implements RecordTranslator {
}
@Override
public Record createRecord(long dataTypeID, String name, long categoryID, long sourceArchiveID,
public DBRecord createRecord(long dataTypeID, String name, long categoryID, long sourceArchiveID,
long sourceDataTypeID, long lastChangeTime) throws IOException {
throw new UnsupportedOperationException("Not allowed to update prior version #" + VERSION +
" of " + TYPEDEF_TABLE_NAME + " table.");
}
@Override
public Record getRecord(long typedefID) throws IOException {
public DBRecord getRecord(long typedefID) throws IOException {
return translateRecord(table.getRecord(typedefID));
}
@ -85,7 +85,7 @@ class TypedefDBAdapterV0 extends TypedefDBAdapter implements RecordTranslator {
}
@Override
public void updateRecord(Record record, boolean setLastChangeTime) throws IOException {
public void updateRecord(DBRecord record, boolean setLastChangeTime) throws IOException {
throw new UnsupportedOperationException();
}
@ -105,11 +105,11 @@ class TypedefDBAdapterV0 extends TypedefDBAdapter implements RecordTranslator {
}
@Override
public Record translateRecord(Record oldRec) {
public DBRecord translateRecord(DBRecord oldRec) {
if (oldRec == null) {
return null;
}
Record rec = TypedefDBAdapter.SCHEMA.createRecord(oldRec.getKey());
DBRecord rec = TypedefDBAdapter.SCHEMA.createRecord(oldRec.getKey());
rec.setLongValue(TYPEDEF_DT_ID_COL, oldRec.getLongValue(V0_TYPEDEF_DT_ID_COL));
rec.setString(TYPEDEF_NAME_COL, oldRec.getString(V0_TYPEDEF_NAME_COL));
rec.setLongValue(TYPEDEF_CAT_COL, oldRec.getLongValue(V0_TYPEDEF_CAT_COL));
@ -121,7 +121,7 @@ class TypedefDBAdapterV0 extends TypedefDBAdapter implements RecordTranslator {
}
@Override
Record getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
DBRecord getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
return null;
}

View file

@ -78,7 +78,7 @@ class TypedefDBAdapterV1 extends TypedefDBAdapter {
}
@Override
public Record createRecord(long dataTypeID, String name, long categoryID, long sourceArchiveID,
public DBRecord createRecord(long dataTypeID, String name, long categoryID, long sourceArchiveID,
long sourceDataTypeID, long lastChangeTime) throws IOException {
long tableKey = table.getKey();
@ -87,7 +87,7 @@ class TypedefDBAdapterV1 extends TypedefDBAdapter {
// }
long key = DataTypeManagerDB.createKey(DataTypeManagerDB.TYPEDEF, tableKey);
Record record = V1_SCHEMA.createRecord(key);
DBRecord record = V1_SCHEMA.createRecord(key);
record.setLongValue(V1_TYPEDEF_DT_ID_COL, dataTypeID);
record.setString(V1_TYPEDEF_NAME_COL, name);
record.setLongValue(V1_TYPEDEF_CAT_COL, categoryID);
@ -100,7 +100,7 @@ class TypedefDBAdapterV1 extends TypedefDBAdapter {
}
@Override
public Record getRecord(long typedefID) throws IOException {
public DBRecord getRecord(long typedefID) throws IOException {
return table.getRecord(typedefID);
}
@ -110,7 +110,7 @@ class TypedefDBAdapterV1 extends TypedefDBAdapter {
}
@Override
public void updateRecord(Record record, boolean setLastChangeTime) throws IOException {
public void updateRecord(DBRecord record, boolean setLastChangeTime) throws IOException {
if (setLastChangeTime) {
record.setLongValue(TypedefDBAdapter.TYPEDEF_LAST_CHANGE_TIME_COL,
(new Date()).getTime());
@ -134,12 +134,12 @@ class TypedefDBAdapterV1 extends TypedefDBAdapter {
}
@Override
Record getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
DBRecord getRecordWithIDs(UniversalID sourceID, UniversalID datatypeID) throws IOException {
Field[] keys =
table.findRecords(new LongField(datatypeID.getValue()), V1_TYPEDEF_UNIVERSAL_DT_ID_COL);
for (int i = 0; i < keys.length; i++) {
Record record = table.getRecord(keys[i]);
DBRecord record = table.getRecord(keys[i]);
if (record.getLongValue(V1_TYPEDEF_SOURCE_ARCHIVE_ID_COL) == sourceID.getValue()) {
return record;
}

View file

@ -19,7 +19,7 @@ import java.io.IOException;
import java.util.*;
import db.Field;
import db.Record;
import db.DBRecord;
import ghidra.docking.settings.Settings;
import ghidra.program.database.DBObjectCache;
import ghidra.program.model.data.*;
@ -46,7 +46,7 @@ class UnionDB extends CompositeDB implements Union {
*/
public UnionDB(DataTypeManagerDB dataMgr, DBObjectCache<DataTypeDB> cache,
CompositeDBAdapter compositeAdapter, ComponentDBAdapter componentAdapter,
Record record) {
DBRecord record) {
super(dataMgr, cache, compositeAdapter, componentAdapter, record);
}
@ -58,7 +58,7 @@ class UnionDB extends CompositeDB implements Union {
try {
Field[] ids = componentAdapter.getComponentIdsInComposite(key);
for (Field id : ids) {
Record rec = componentAdapter.getRecord(id.getLongValue());
DBRecord rec = componentAdapter.getRecord(id.getLongValue());
components.add(new DataTypeComponentDB(dataMgr, componentAdapter, this, rec));
}
}
@ -146,7 +146,7 @@ class UnionDB extends CompositeDB implements Union {
private DataTypeComponentDB createComponent(long dtID, int length, int ordinal, int offset,
String name, String comment) {
Record rec;
DBRecord rec;
try {
rec = componentAdapter.createRecord(dtID, key, length, ordinal, offset, name, comment);
return new DataTypeComponentDB(dataMgr, componentAdapter, this, rec);

View file

@ -126,7 +126,7 @@ public class ExternalManagerDB implements ManagerDB, ExternalManager {
RecordIterator iter = oldNameAdapter.getRecords();
while (iter.hasNext()) {
monitor.checkCanceled();
Record rec = iter.next();
DBRecord rec = iter.next();
String name = rec.getString(OldExtNameAdapter.EXT_NAME_COL);
try {
@ -153,7 +153,7 @@ public class ExternalManagerDB implements ManagerDB, ExternalManager {
iter = oldExtRefAdapter.getRecords();
while (iter.hasNext()) {
monitor.checkCanceled();
Record rec = iter.next();
DBRecord rec = iter.next();
Address fromAddr =
oldAddrMap.decodeAddress(rec.getLongValue(OldExtRefAdapter.FROM_ADDR_COL));

Some files were not shown because too many files have changed in this diff Show more