Loading ...
Sorry, an error occurred while loading the content.

"long" and "CLOB" type data

Expand Messages
  • yu_ching
    My database has long and CLOB type, and I must use different method to get data from database. Can you tell me that how do I modify the TransferResultSet?
    Message 1 of 2 , Apr 9, 2002
    • 0 Attachment
      My database has "long" and "CLOB" type, and I must use different method to
      get data from database.
      Can you tell me that how do I modify the TransferResultSet?

      ******************************************************
      public String getClobString(String name) throws Exception {

      BufferedReader br = null;
      StringBuffer sb = new StringBuffer();
      String tmp = "";

      Clob clob = rst.getClob(name);
      br = new BufferedReader(clob.getCharacterStream());

      while ((tmp=br.readLine()) != null) {
      sb.append(tmp);
      }
      return Encoding(sb.toString());
      }

      ****************************************************
      public String getLongString(String name) throws Exception {
      return Encoding(Util.CharStrimToString(
      rst.getCharacterStream(name)));
      }
      ******************************************************
      Thanks!!
    • Ronald Bourret
      You need to make this change in DBMSToDOM.populateRow, not TransferResultSet. Change: row.columnValues[i] = rs.getObject(table.rsColumnNumbers[i]); to: //
      Message 2 of 2 , Apr 11, 2002
      • 0 Attachment
        You need to make this change in DBMSToDOM.populateRow, not
        TransferResultSet. Change:

        row.columnValues[i] = rs.getObject(table.rsColumnNumbers[i]);

        to:

        // NOTE: This code has not been compiled or tested. You will need to
        // modify the code where there are question marks.

        int colNum = table.rsColumnNumbers[i];

        if (table.columns[colNum].type == ??LONG??)
        row.columnValues[i] = getLongString(??);
        else if (table.columns[colNum].type == ??CLOB??)
        row.columnValues[i] = getClobString(???);
        else
        row.columnValues[i] = rs.getObject(table.rsColumnNumbers[i]);

        -- Ron

        yu_ching wrote:
        >
        > My database has "long" and "CLOB" type, and I must use different method to
        > get data from database.
        > Can you tell me that how do I modify the TransferResultSet?
        >
        > ******************************************************
        > public String getClobString(String name) throws Exception {
        >
        > BufferedReader br = null;
        > StringBuffer sb = new StringBuffer();
        > String tmp = "";
        >
        > Clob clob = rst.getClob(name);
        > br = new BufferedReader(clob.getCharacterStream());
        >
        > while ((tmp=br.readLine()) != null) {
        > sb.append(tmp);
        > }
        > return Encoding(sb.toString());
        > }
        >
        > ****************************************************
        > public String getLongString(String name) throws Exception {
        > return Encoding(Util.CharStrimToString(
        > rst.getCharacterStream(name)));
        > }
        > ******************************************************
      Your message has been successfully submitted and would be delivered to recipients shortly.