haul        02/01/30 01:40:42

  Modified:    src/java/org/apache/cocoon/components/language/markup/xsp
                        EsqlHelper.java
  Log:
  getAscii required column name. now accepts column number as well.
  
  Revision  Changes    Path
  1.3       +24 -0     
xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/EsqlHelper.java
  
  Index: EsqlHelper.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/EsqlHelper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EsqlHelper.java   7 Jan 2002 11:05:23 -0000       1.2
  +++ EsqlHelper.java   30 Jan 2002 09:40:42 -0000      1.3
  @@ -46,6 +46,30 @@
           return new String(buffer);
         }                                                                             
                                         
   
  +      public final static String getAscii(ResultSet set, int column) {
  +        InputStream asciiStream = null;
  +        byte[] buffer = null;
  + 
  +        try {
  +            Clob dbClob = set.getClob(column);
  +            int length = (int) dbClob.length();
  +            asciiStream = new BufferedInputStream(dbClob.getAsciiStream());
  +            buffer = new byte[length];
  +            asciiStream.read(buffer);
  +            asciiStream.close();
  +        } catch (Exception e) {
  +            throw new RuntimeException("Error getting clob data: " + 
e.getMessage());
  +        } finally {
  +            if (asciiStream != null) try {asciiStream.close();} catch (Exception 
ase) {
  +                throw new RuntimeException("Error closing clob stream: " + 
ase.getMessage());
  +            }
  +        }
  + 
  +        if (buffer == null) return "";
  + 
  +        return new String(buffer);
  +      }                                                                             
                                         
  +
         public final static String getStringFromByteArray(byte[] bytes, String 
encoding) {
           try {
               return new String(bytes,encoding);
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to