Beispiel #1
0
  public String getString() throws SQLException {
    if (savedObject_ != null) // @loch
    { // @loch
      // get value from RS.updateX(value)
      doConversion(); // @loch
      truncated_ = 0; // @loch
      return value_; // @loch
    } // @loch

    DBLobData data = locator_.retrieveData(0, locator_.getMaxLength());
    String value =
        converter_.byteArrayToString(data.getRawBytes(), data.getOffset(), data.getLength());
    truncated_ = 0; // @pda make consistent with other SQLData Clob classes
    return value;
  }
  // @pda jdbc40
  public String getNString() throws SQLException {
    truncated_ = 0;
    outOfBounds_ = false;

    if (savedObject_ != null) // @loch
    { // @loch
      // get value from RS.updateX(value)
      doConversion(); // @loch
      truncated_ = 0;
      outOfBounds_ = false; // @loch
      return value_; // @loch
    } // @loch

    DBLobData data = locator_.retrieveData(0, locator_.getMaxLength());
    String value =
        converter_.byteArrayToString(data.getRawBytes(), data.getOffset(), data.getLength());
    return value;
  }
Beispiel #3
0
  public byte[] getBytes() throws SQLException {
    if (savedObject_ != null) // @loch
    { // @loch
      // get value from RS.updateX(value)
      doConversion(); // @loch
      truncated_ = 0;
      outOfBounds_ = false; // @loch
      return value_; // @loch
    } // @loch

    int locatorLength = (int) locator_.getLength();
    if (locatorLength == 0) return new byte[0];
    DBLobData data = locator_.retrieveData(0, locatorLength);
    int actualLength = data.getLength();
    byte[] bytes = new byte[actualLength];
    System.arraycopy(data.getRawBytes(), data.getOffset(), bytes, 0, actualLength);
    truncated_ = 0;
    outOfBounds_ = false;
    return bytes;
  }