Modifier and Type | Class and Description |
---|---|
class |
GPDBWritable.TypeMismatchException
An exception class for column type definition and
set/get value mismatch.
|
Modifier and Type | Field and Description |
---|---|
protected int |
alignmentOfEightBytes |
protected int[] |
colType |
protected java.lang.Object[] |
colValue |
protected byte |
errorFlag |
protected int |
pktlen |
Constructor and Description |
---|
GPDBWritable()
Empty Constructor
|
GPDBWritable(byte[] data)
Constructor to build a db record from a serialized form.
|
GPDBWritable(int[] columnType)
Constructor to build a db record.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Boolean |
getBoolean(int colIdx)
Gets the column value of the record.
|
byte[] |
getBytes(int colIdx)
Gets the column value of the record.
|
int[] |
getColType() |
java.lang.Double |
getDouble(int colIdx)
Gets the column value of the record.
|
java.lang.Float |
getFloat(int colIdx)
Gets the column value of the record.
|
java.lang.Integer |
getInt(int colIdx)
Gets the column value of the record.
|
java.lang.Long |
getLong(int colIdx)
Gets the column value of the record.
|
java.lang.Short |
getShort(int colIdx)
Gets the column value of the record.
|
java.lang.String |
getString(int colIdx)
Gets the column value of the record.
|
static java.lang.String |
getTypeName(int oid)
Helper to get the type name.
|
boolean |
isEmpty()
Returns if the writable object is empty,
based on the pkt len as read from stream.
|
void |
readFields(java.io.DataInput in)
Deserialize the fields of this object from
in . |
void |
setBoolean(int colIdx,
java.lang.Boolean val)
Sets the column value of the record.
|
void |
setBytes(int colIdx,
byte[] val)
Sets the column value of the record.
|
void |
setDouble(int colIdx,
java.lang.Double val)
Sets the column value of the record.
|
void |
setError(boolean errorVal)
Sets the error field.
|
void |
setFloat(int colIdx,
java.lang.Float val)
Sets the column value of the record.
|
void |
setInt(int colIdx,
java.lang.Integer val)
Sets the column value of the record.
|
void |
setLong(int colIdx,
java.lang.Long val)
Sets the column value of the record.
|
void |
setShort(int colIdx,
java.lang.Short val)
Sets the column value of the record.
|
void |
setString(int colIdx,
java.lang.String val)
Sets the column value of the record.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
void |
write(java.io.DataOutput out)
Serialize the fields of this object to
out . |
protected int[] colType
protected java.lang.Object[] colValue
protected int alignmentOfEightBytes
protected byte errorFlag
protected int pktlen
public GPDBWritable()
public GPDBWritable(int[] columnType)
columnType
- the table column typespublic GPDBWritable(byte[] data) throws java.io.IOException
data
- a record in the serialized formjava.io.IOException
- if the data is malformatted.public int[] getColType()
public void readFields(java.io.DataInput in) throws java.io.IOException
Writable
in
.
For efficiency, implementations should attempt to re-use storage in the existing object where possible.
readFields
in interface Writable
in
- DataInput
to deserialize this object from.java.io.IOException
- if I/O error occurspublic void write(java.io.DataOutput out) throws java.io.IOException
Writable
out
.public void setLong(int colIdx, java.lang.Long val) throws GPDBWritable.TypeMismatchException
colIdx
- the column indexval
- the valueGPDBWritable.TypeMismatchException
- the column type does not matchpublic void setBoolean(int colIdx, java.lang.Boolean val) throws GPDBWritable.TypeMismatchException
colIdx
- the column indexval
- the valueGPDBWritable.TypeMismatchException
- the column type does not matchpublic void setBytes(int colIdx, byte[] val) throws GPDBWritable.TypeMismatchException
colIdx
- the column indexval
- the valueGPDBWritable.TypeMismatchException
- the column type does not matchpublic void setString(int colIdx, java.lang.String val) throws GPDBWritable.TypeMismatchException
colIdx
- the column indexval
- the valueGPDBWritable.TypeMismatchException
- the column type does not matchpublic void setFloat(int colIdx, java.lang.Float val) throws GPDBWritable.TypeMismatchException
colIdx
- the column indexval
- the valueGPDBWritable.TypeMismatchException
- the column type does not matchpublic void setDouble(int colIdx, java.lang.Double val) throws GPDBWritable.TypeMismatchException
colIdx
- the column indexval
- the valueGPDBWritable.TypeMismatchException
- the column type does not matchpublic void setInt(int colIdx, java.lang.Integer val) throws GPDBWritable.TypeMismatchException
colIdx
- the column indexval
- the valueGPDBWritable.TypeMismatchException
- the column type does not matchpublic void setShort(int colIdx, java.lang.Short val) throws GPDBWritable.TypeMismatchException
colIdx
- the column indexval
- the valueGPDBWritable.TypeMismatchException
- the column type does not matchpublic java.lang.Long getLong(int colIdx) throws GPDBWritable.TypeMismatchException
colIdx
- the column indexGPDBWritable.TypeMismatchException
- the column type does not matchpublic java.lang.Boolean getBoolean(int colIdx) throws GPDBWritable.TypeMismatchException
colIdx
- the column indexGPDBWritable.TypeMismatchException
- the column type does not matchpublic byte[] getBytes(int colIdx) throws GPDBWritable.TypeMismatchException
colIdx
- the column indexGPDBWritable.TypeMismatchException
- the column type does not matchpublic java.lang.String getString(int colIdx) throws GPDBWritable.TypeMismatchException
colIdx
- the column indexGPDBWritable.TypeMismatchException
- the column type does not matchpublic java.lang.Float getFloat(int colIdx) throws GPDBWritable.TypeMismatchException
colIdx
- the column indexGPDBWritable.TypeMismatchException
- the column type does not matchpublic java.lang.Double getDouble(int colIdx) throws GPDBWritable.TypeMismatchException
colIdx
- the column indexGPDBWritable.TypeMismatchException
- the column type does not matchpublic java.lang.Integer getInt(int colIdx) throws GPDBWritable.TypeMismatchException
colIdx
- the column indexGPDBWritable.TypeMismatchException
- the column type does not matchpublic java.lang.Short getShort(int colIdx) throws GPDBWritable.TypeMismatchException
colIdx
- the column indexGPDBWritable.TypeMismatchException
- the column type does not matchpublic void setError(boolean errorVal)
errorVal
- the error valuepublic java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String getTypeName(int oid)
oid
- type OIDpublic boolean isEmpty()