public class DbChar extends DbValue
DbChar
class represents character strings. All
SQL string literals in Java programs, such as "VarChar"
and "NVarChar"
,
are implemented as instances of this class.
DbChar supports mutable strings. A DbChar
represents a string in the UTF-16 format
with default coding 8859-1. This class also supports other encodings.
You can set DbColDesc desc in the constructor with the
encoding name GBK, etc, and use getRaw and setRaw methods for other encodings.
Modifier and Type | Field and Description |
---|---|
java.lang.String |
value
Deprecated.
|
BIGINT_DESC, bNull, CHAR_DESC, CURRENCY_DESC, DATE_DESC, desc, DOUBLE_DESC, INTEGER_DESC, TIME_DESC
Constructor and Description |
---|
DbChar()
Constructs an uninitialized
DbChar . |
DbChar(DbColDesc desc)
Constructs an uninitialized
DbChar . |
DbChar(java.lang.String val)
Constructs an uninitialized
DbChar . |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Creates a clone of this
DbChar object. |
int |
compareTo(DbValue v,
boolean matchSQL)
Compares this
DbChar object with the DbValue object. |
boolean |
equals(DbValue v)
Compares this object to the specified object.
|
java.lang.String |
get()
Returns the value of this
DbChar as a
String value. |
byte[] |
getRaw()
Returns the value of this
DbChar as a
String value. |
void |
set(DbValue v)
Sets a newly allocated
DbChar object that
represents the String value indicated by the
DbValue parameter. |
void |
set(JRHierarchicalDataset hds,
int col)
Sets a newly allocated
DbChar object that
represents the String value indicated by the
JRHierarchicalDataset parameter and an index of the column. |
void |
set(java.sql.ResultSet rs,
int col)
Sets a newly allocated
DbChar object that
represents the boolean value indicated by the
ResultSet parameter and an index of the column. |
void |
set(java.lang.String v)
Sets a newly allocated
DbChar object that
represents the specified String argument. |
void |
setRaw(byte[] bytes)
Sets a newly allocated
DbChar object that
represents the specified byte array argument. |
void |
setValue(java.lang.String v)
Sets a newly allocated
DbChar object that
represents the String value indicated by the
String parameter. |
java.lang.String |
toConvertString()
Returns a
String object representing this
DbChar 's value. |
java.lang.String |
toString()
Returns a
String object representing this
DbChar 's value. |
java.lang.String |
toStringValue() |
compareTo, compareTo, compareTo, equals, getColDesc, getDataTimeZone, getPrecision, getScale, getSqlType, isCurrency, isNull, makeDbValue, setColDesc, setfoo, setNull, setValue
public java.lang.String value
get
and set
to access it instead of accessing it directly.public DbChar()
DbChar
. This
DbChar object is mutable until the value and the description of the column are set.public DbChar(java.lang.String val)
DbChar
. This
DbBit object is mutable until DbColDesc is set.val
- The value holding a String
.public DbChar(DbColDesc desc)
DbChar
. This
DbChar
object is mutable until the value is set.desc
- The value to be represented by the
DbColDesc
object.public byte[] getRaw()
DbChar
as a
String
value. This method uses the desc.getEncodingName()
to encode the value and return an encoded string.
Note this method should be used with setRaw.public void setRaw(byte[] bytes)
DbChar
object that
represents the specified byte
array argument.
This method uses the desc.getEncodingName()
to encode the value and set encoded string.
Note this method should be used with getRaw.v
- The value to be represented by the byte
array.public final java.lang.String get()
DbChar
as a
String
value.public final void set(java.lang.String v)
DbChar
object that
represents the specified String
argument.v
- The value to be represented by the String
object.public void set(java.sql.ResultSet rs, int col) throws java.sql.SQLException
DbChar
object that
represents the boolean
value indicated by the
ResultSet
parameter and an index of the column.public void set(JRHierarchicalDataset hds, int col) throws java.sql.SQLException
DbChar
object that
represents the String
value indicated by the
JRHierarchicalDataset
parameter and an index of the column.public java.lang.String toString()
String
object representing this
DbChar
's value. The value is returned as a string.
if the value is null, it returns "NULL".public java.lang.String toConvertString()
String
object representing this
DbChar
's value.
If encoded, returns a new string with 8859_1.
If the value is null, it returns "NULL".public java.lang.Object clone()
DbChar
object.public boolean equals(DbValue v)
true
if and only if the argument is not
null
but a DbChar
object that
contains the same String
value as this object.public int compareTo(DbValue v, boolean matchSQL)
DbChar
object with the DbValue object.public void set(DbValue v)
DbChar
object that
represents the String
value indicated by the
DbValue
parameter. The DbValue object will be checked to see if it is null.public void setValue(java.lang.String v)
DbChar
object that
represents the String
value indicated by the
String
parameter.public java.lang.String toStringValue()
toStringValue
in class DbValue