cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nicola...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/transformation SQLTransformer.java
Date Thu, 18 Apr 2002 16:26:49 GMT
nicolaken    02/04/18 09:26:49

  Modified:    src/java/org/apache/cocoon/transformation
                        SQLTransformer.java
  Log:
  Patch 8056 from acoliver@apache.org
  "The SQL Transformer does those nastly looking exponents for large values.  By
  calling "getBigDecimal()" instead of getObject we can call an overridden
  toString and avoid those nasty things."
  
  Revision  Changes    Path
  1.11      +17 -4     xml-cocoon2/src/java/org/apache/cocoon/transformation/SQLTransformer.java
  
  Index: SQLTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/SQLTransformer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SQLTransformer.java	8 Apr 2002 12:47:50 -0000	1.10
  +++ SQLTransformer.java	18 Apr 2002 16:26:48 -0000	1.11
  @@ -85,7 +85,7 @@
    * @author <a href="mailto:giacomo.pati@pwr.ch">Giacomo Pati</a>
    *         (PWR Organisation & Entwicklung)
    * @author <a href="mailto:sven.beauprez@the-ecorp.com">Sven Beauprez</a>
  - * @version CVS $Id: SQLTransformer.java,v 1.10 2002/04/08 12:47:50 cziegeler Exp $
  + * @version CVS $Id: SQLTransformer.java,v 1.11 2002/04/18 16:26:48 nicolaken Exp $
    */
   
   public class SQLTransformer
  @@ -1124,11 +1124,20 @@
           }
   
           protected String getColumnValue( int i ) throws SQLException {
  -            return transformer.getStringValue( rs.getObject( i ) );
  +            String retval =  transformer.getStringValue( rs.getObject( i ) );
  +            if (rs.getMetaData().getColumnType(i) == 8) 
  +		retval = transformer.getStringValue( rs.getBigDecimal( i ) );
  +            return retval;
           }
   
  +        //fix not applied here because there is no metadata from Name -> number and
coltype
  +        //for a given "name" versus number.  That being said this shouldn't be an issue
  +        //as this function is only called for ancestor lookups.
           protected String getColumnValue( String name ) throws SQLException {
  -            return transformer.getStringValue( rs.getObject( name ) );
  +            String retval =  transformer.getStringValue( rs.getObject( name ) );
  +//          if (rs.getMetaData().getColumnType( name ) == 8) 
  +//		retval = transformer.getStringValue( rs.getBigDecimal( name ) );
  +            return retval;
           }
   
           protected boolean next() throws SQLException {
  @@ -1256,7 +1265,11 @@
                                       transformer.start( this.row_name, attr );
                                       for ( int i = 1; i <= md.getColumnCount(); i++ )
{
                                           transformer.start( md.getColumnName( i ).toLowerCase(),
attr );
  -                                        this.serializeData(manager, transformer.getStringValue(
rs.getObject( i ) ));
  +                                        if ( md.getColumnType( i ) == 8 ) {  //prevent
nasty exponent notation
  +                                            this.serializeData(manager, transformer.getStringValue(
rs.getBigDecimal( i ) ));
  +                                        } else {
  +                                            this.serializeData(manager, transformer.getStringValue(
rs.getObject( i ) ));
  +                                        }
                                           transformer.end( md.getColumnName( i ).toLowerCase()
);
                                       }
                                       transformer.end( this.row_name );
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message