Package db
Class Schema
java.lang.Object
db.Schema
Class for definining the columns in a Ghidra Database table.
-
Constructor Summary
ConstructorDescriptionConstruct a new Schema.Schema
(int version, Field keyField, String keyName, Field[] fields, String[] fieldNames, int[] sparseColumns) Construct a new Schema.Schema
(int version, Class<?> keyClass, String keyName, Class<?>[] fieldClasses, String[] fieldNames) Construct a new Schema.Schema
(int version, Class<?> keyClass, String keyName, Class<?>[] fieldClasses, String[] fieldNames, int[] sparseColumns) Construct a new Schema.Construct a new Schema which uses a long key.Construct a new Schema which uses a long key.Construct a new Schema which uses a long key.Schema
(int version, String keyName, Class<?>[] fieldClasses, String[] fieldNames, int[] sparseColumns) Construct a new Schema which uses a long key. -
Method Summary
Modifier and TypeMethodDescriptioncreateRecord
(long key) Create an empty record for the specified key.createRecord
(Field key) Create an empty record for the specified key.boolean
Compare two schemas for equality.int
Get the number of data FieldsString[]
Get the list of data Field names for this schema.Field[]
Get the list of data Field classes for this schema.int
Get length of fixed-length schema record.Get the Field type for the key.Get the key nameint
Get the schema version.int
hashCode()
boolean
Determine if schema employs sparse column storageboolean
isSparseColumn
(int columnIndex) Determine if the specified column index has been designated as a sparse column within the associated record storageboolean
Returns true if records for this Schema can be of variable lengths.toString()
-
Constructor Details
-
Schema
public Schema(int version, Field keyField, String keyName, Field[] fields, String[] fieldNames, int[] sparseColumns) Construct a new Schema.- Parameters:
version
- schema versionkeyField
- field associated with primary key (representative instance)keyName
- primary key namefields
- array of column fields (representative instances)fieldNames
- array of column field namessparseColumns
- column indexes corresponding to those columns which utilize sparse storage (null if no sparse columns). Valid sparse column indexes are in the range 0..127.- Throws:
IllegalArgumentException
- invalid parameters
-
Schema
Construct a new Schema.- Parameters:
version
- schema versionkeyField
- field associated with primary key (representative instance)keyName
- primary key namefields
- array of column fields (representative instances)fieldNames
- array of column field names- Throws:
IllegalArgumentException
- invalid parameters
-
Schema
Construct a new Schema which uses a long key.- Parameters:
version
- schema versionkeyName
- primary key namefields
- array of column fields (representative instances)fieldNames
- array of column field names- Throws:
IllegalArgumentException
- invalid parameters
-
Schema
public Schema(int version, String keyName, Field[] fields, String[] fieldNames, int[] sparseColumns) Construct a new Schema which uses a long key.- Parameters:
version
- schema versionkeyName
- primary key namefields
- array of column fields (representative instances)fieldNames
- array of column field namessparseColumns
- column indexes corresponding to those columns which utilize sparse storage (null if no sparse columns). Valid sparse column indexes are in the range 0..127.- Throws:
IllegalArgumentException
- invalid parameters
-
Schema
public Schema(int version, Class<?> keyClass, String keyName, Class<?>[] fieldClasses, String[] fieldNames) Construct a new Schema.- Parameters:
version
- schema versionkeyClass
- field class associated with primary keykeyName
- primary key namefieldClasses
- array of column field classesfieldNames
- array of column field names- Throws:
IllegalArgumentException
- invalid parameters
-
Schema
public Schema(int version, Class<?> keyClass, String keyName, Class<?>[] fieldClasses, String[] fieldNames, int[] sparseColumns) Construct a new Schema.- Parameters:
version
- schema versionkeyClass
- field class associated with primary keykeyName
- primary key namefieldClasses
- array of column field classesfieldNames
- array of column field namessparseColumns
- column indexes corresponding to those columns which utilize sparse storage (null if no sparse columns). Valid sparse column indexes are in the range 0..127.- Throws:
IllegalArgumentException
- invalid parameters
-
Schema
Construct a new Schema which uses a long key.- Parameters:
version
- schema versionkeyName
- primary key namefieldClasses
- array of column field classesfieldNames
- array of column field names- Throws:
IllegalArgumentException
- invalid parameters
-
Schema
public Schema(int version, String keyName, Class<?>[] fieldClasses, String[] fieldNames, int[] sparseColumns) Construct a new Schema which uses a long key.- Parameters:
version
- schema versionkeyName
- primary key namefieldClasses
- array of column field classesfieldNames
- array of column field namessparseColumns
- column indexes corresponding to those columns which utilize sparse storage (null if no sparse columns). Valid sparse column indexes are in the range 0..127.- Throws:
IllegalArgumentException
- invalid parameters
-
-
Method Details
-
hasSparseColumns
public boolean hasSparseColumns()Determine if schema employs sparse column storage- Returns:
- true if schema employs sparse column storage
-
isSparseColumn
public boolean isSparseColumn(int columnIndex) Determine if the specified column index has been designated as a sparse column within the associated record storage- Parameters:
columnIndex
- column index- Returns:
- true if designated column uses sparse storage
-
getKeyFieldType
Get the Field type for the key.- Returns:
- key Field type
-
getKeyName
Get the key name- Returns:
- key name
-
getFields
Get the list of data Field classes for this schema. The returned list is ordered consistent with the schema definition.- Returns:
- data Field classes
-
getFieldNames
Get the list of data Field names for this schema. The returned list is ordered consistent with the schema definition.- Returns:
- data Field names
-
getFieldCount
public int getFieldCount()Get the number of data Fields- Returns:
- data Field count
-
getVersion
public int getVersion()Get the schema version.- Returns:
- schema version
-
isVariableLength
public boolean isVariableLength()Returns true if records for this Schema can be of variable lengths.- Returns:
- true if records with this Schema are variable length.
-
getFixedLength
public int getFixedLength()Get length of fixed-length schema record.- Returns:
- record length or 0 for variable length.
-
createRecord
Create an empty record for the specified key.- Parameters:
key
- long key- Returns:
- new record
-
createRecord
Create an empty record for the specified key.- Parameters:
key
- record key field- Returns:
- new record
-
equals
Compare two schemas for equality. Field names are ignored in this comparison. Instance variables such asfixedLength
,isVariableLength
andforceUseVariableLengthKeyNodes
are also ignored. -
hashCode
public int hashCode() -
toString
-