Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jet.connect
Class DbChar

    java.lang.Object
      jet.connect.DbValue
          jet.connect.DbChar

All Implemented Interfaces:
  jet.util.DbValueable, jet.util.QuickSortableNode

Direct Known Subclasses:
  fText

    public class DbChar

extends DbValue

The `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.

Field Summary
`java.lang.String` | `value` Deprecated.

Fields inherited from class jet.connect.DbValue
`bNull, CHAR_DESC, CURRENCY_DESC, DATE_DESC, desc, DOUBLE_DESC, INTEGER_DESC, TIME_DESC`

Fields inherited from interface jet.util.DbValueable
`EQUAL, GREATER, LESS`

Constructor Summary
`DbChar()` Constructs an uninitialized `DbChar`.
`DbChar(DbColDesc desc)` Constructs an uninitialized `DbChar`.
`DbChar(java.lang.String val)` Constructs an uninitialized `DbChar`.

Method Summary
`java.lang.Object` | `clone()` Creates a clone of this `DbChar` object.
`int` | `compareTo(DbValue v)` 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()`

Methods inherited from class jet.connect.DbValue
`compareTo, compareTo, equals, getColDesc, getPrecision, getScale, getSqlType, isCurrency, isNull, makeDbValue, setColDesc, setfoo, setNull, setValue`

Methods inherited from class java.lang.Object
`getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### value

    public java.lang.String value

  Deprecated.
  The field contains the value of this object. Note, use `get` and `set` to access it instead of accessing it directly.

Constructor Detail

### DbChar

    public DbChar()

  Constructs an uninitialized `DbChar`. This DbChar object is mutable until the value and the description of the column are set.

### DbChar

    public DbChar(java.lang.String val)

  Constructs an uninitialized `DbChar`. This DbBit object is mutable until DbColDesc is set.

  Parameters:
    `val` - The value holding a `String`.

### DbChar

    public DbChar(DbColDesc desc)

  Constructs an uninitialized `DbChar`. This `DbChar` object is mutable until the value is set.

  Parameters:
    `desc` - The value to be represented by the `DbColDesc` object.

Method Detail

### getRaw

    public byte[] getRaw()

  Returns the value of this `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.

### setRaw

    public void setRaw(byte[] bytes)

  Sets a newly allocated `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.

  Parameters:
    `v` - The value to be represented by the `byte` array.

### get

    public final java.lang.String get()

  Returns the value of this `DbChar` as a `String` value.

### set

    public final void set(java.lang.String v)

  Sets a newly allocated `DbChar` object that represents the specified `String` argument.

  Parameters:
    `v` - The value to be represented by the `String` object.

### set

    public void set(java.sql.ResultSet rs,
                    int col)
             throws java.sql.SQLException

  Sets a newly allocated `DbChar` object that represents the `boolean` value indicated by the `ResultSet` parameter and an index of the column.

  Specified by:
    `set` in class `DbValue`
  Parameters:
    `rs` - The `ResultSet` to be fetched.
    `col` - The index of the column.
  Throws:
    `java.sql.SQLException` - if the `ResultSet` does not contain the index.

### set

    public void set(JRHierarchicalDataset hds,
                    int col)
             throws java.sql.SQLException

  Sets a newly allocated `DbChar` object that represents the `String` value indicated by the `JRHierarchicalDataset` parameter and an index of the column.

  Overrides:
    `set` in class `DbValue`
  Parameters:
    `hds` - The `JRHierarchicalDataset` to be fetched.
    `col` - The index of the column.
  Throws:
    `java.sql.SQLException` - if the `ResultSet` does not contain the index.

### toString

    public java.lang.String toString()

  Returns a `String` object representing this `DbChar`'s value. The value is returned as a string. if the value is null, it returns "NULL".

  Specified by:
    `toString` in class `DbValue`
  Returns:
    a string representation of the value of this object.

### toConvertString

    public java.lang.String toConvertString()

  Returns a `String` object representing this `DbChar`'s value. If encoded, returns a new string with 8859_1. If the value is null, it returns "NULL".

  Returns:
    a string representation of the value of this object.

### clone

    public java.lang.Object clone()

  Creates a clone of this `DbChar` object.

  Specified by:
    `clone` in interface `jet.util.DbValueable`
  Specified by:
    `clone` in class `DbValue`

### equals

    public boolean equals(DbValue v)

  Compares this object to the specified object. The result is `true` if and only if the argument is not `null` but a `DbChar` object that contains the same `String` value as this object.

  Specified by:
    `equals` in class `DbValue`
  Parameters:
    `v` - The DbValue object to be compared with.
  Returns:
    `true` if the objects are the same; `false` otherwise.

### compareTo

    public int compareTo(DbValue v)

  Compares this `DbChar` object with the DbValue object.

  Specified by:
    `compareTo` in class `DbValue`
  Returns:
    LESS, EQUAL, or GREAT.
  See Also:
    `DbValueable`

### set

    public void set(DbValue v)

  Sets a newly allocated `DbChar` object that represents the `String` value indicated by the `DbValue` parameter. The DbValue object will be checked to see if it is null.

  Specified by:
    `set` in class `DbValue`
  Parameters:
    `v` - The `DbValue` to be converted to a `DbChar`. If it is null, the value will not be set.

### setValue

    public void setValue(java.lang.String v)

  Sets a newly allocated `DbChar` object that represents the `String` value indicated by the `String` parameter.

  Specified by:
    `setValue` in class `DbValue`
  Parameters:
    `v` - The `String` to be converted to a `DbChar`.

### toStringValue

    public java.lang.String toStringValue()

  Specified by:
    `toStringValue` in class `DbValue`
  Returns:
    a string which will represent the value in the DbValue(null flag and value). When compare StringValue from DbValues, we always assume that: the two DbValues have same DbColDesc. Two StringValue equals means the original DbValue equals. Does NOT transfer the compareTo(DbValue v) method. Only comparable dbValue implements this methods. String coding uses Base64.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD