cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ba...@locus.apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/processor/xsp/library/sql XSPSQLLibrary.java
Date Mon, 01 May 2000 06:27:36 GMT
balld       00/04/30 23:27:36

  Modified:    src/org/apache/cocoon/processor/xsp/library/sql
                        XSPSQLLibrary.java
  Log:
  added nice column formatting code
  
  Revision  Changes    Path
  1.4       +12 -2     xml-cocoon/src/org/apache/cocoon/processor/xsp/library/sql/XSPSQLLibrary.java
  
  Index: XSPSQLLibrary.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/processor/xsp/library/sql/XSPSQLLibrary.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XSPSQLLibrary.java	2000/04/28 19:18:45	1.3
  +++ XSPSQLLibrary.java	2000/05/01 06:27:36	1.4
  @@ -60,7 +60,7 @@
    * A processor that performs SQL database queries.
    *
    * @author <a href="mailto:balld@webslingerZ.com">Donald Ball</a>
  - * @version $Revision: 1.3 $ $Date: 2000/04/28 19:18:45 $
  + * @version $Revision: 1.4 $ $Date: 2000/05/01 06:27:36 $
    */
   
   public class XSPSQLLibrary {
  @@ -86,6 +86,7 @@
         String update_rows_attribute,
         String namespace,
         String query,
  +	  /** a table of Formats indexed by column name **/
         Hashtable column_formats
   	) throws Exception {
   
  @@ -181,6 +182,8 @@
                   }
                   for (int i=0; i<columns.length; i++) {
   					Object value = rs.getObject(i+1);
  +					System.err.println(value.toString());
  +					System.err.println("CLASS: "+value.getClass().getName());
                       if (create_row_elements && create_id_attribute && id_attribute_column_index
== i) {
                           row_element.setAttribute(id_attribute,value.toString());
                           continue;
  @@ -193,7 +196,14 @@
                           column_element.setAttribute("NULL","YES");
                           column_element.appendChild(document.createTextNode(""));
                       } else {
  -						column_element.appendChild(document.createTextNode(value.toString()));
  +						Format format = (Format)column_formats.get(columns[i].name);
  +						String formatted_value;
  +						if (format == null) {
  +							formatted_value = value.toString();
  +						} else {
  +							formatted_value = format.format(value);
  +						}
  +						column_element.appendChild(document.createTextNode(formatted_value));
                       }
                       row_node.appendChild(column_element);
                   }
  
  
  

Mime
View raw message