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 19:42:49 GMT
balld       00/05/01 12:42:48

  Modified:    src/org/apache/cocoon/processor/xsp/library/sql
                        XSPSQLLibrary.java
  Log:
  fixed it so it does arrays like SQLProcessor
  
  Revision  Changes    Path
  1.5       +17 -11    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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XSPSQLLibrary.java	2000/05/01 06:27:36	1.4
  +++ XSPSQLLibrary.java	2000/05/01 19:42:48	1.5
  @@ -60,7 +60,7 @@
    * A processor that performs SQL database queries.
    *
    * @author <a href="mailto:balld@webslingerZ.com">Donald Ball</a>
  - * @version $Revision: 1.4 $ $Date: 2000/05/01 06:27:36 $
  + * @version $Revision: 1.5 $ $Date: 2000/05/01 19:42:48 $
    */
   
   public class XSPSQLLibrary {
  @@ -182,10 +182,23 @@
                   }
                   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());
  +					String formatted_value;
  +					Format format = (Format)column_formats.get(columns[i].name);
  +					if (value == null) {
  +						formatted_value = "";
  +					} else if (format == null) {
  +						if (value instanceof byte[]) {
  +							formatted_value = new String((byte[])value);
  +						} else if (value instanceof char[]) {
  +							formatted_value = new String((char[])value);
  +						} else {
  +							formatted_value = value.toString();
  +						}
  +					} else {
  +						formatted_value = format.format(value);
  +					}
                       if (create_row_elements && create_id_attribute && id_attribute_column_index
== i) {
  -                        row_element.setAttribute(id_attribute,value.toString());
  +                        row_element.setAttribute(id_attribute,formatted_value);
                           continue;
                       }
                       if (value == null && !indicate_nulls) {
  @@ -196,13 +209,6 @@
                           column_element.setAttribute("NULL","YES");
                           column_element.appendChild(document.createTextNode(""));
                       } else {
  -						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