cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/databases/java/org/apache/cocoon/util JDBCTypeConversions.java
Date Tue, 01 Jul 2003 11:29:55 GMT
haul        2003/07/01 04:29:55

  Modified:    src/blocks/databases/java/org/apache/cocoon/util
                        JDBCTypeConversions.java
  Log:
    <action dev="CH" type="update">
      Added feature to allow a database action (i.e. delete) not to fail if no
      row was affected. Formating. Use toString() to convert to String rather
      than cast.
    </action>
  
  Revision  Changes    Path
  1.4       +11 -11    cocoon-2.1/src/blocks/databases/java/org/apache/cocoon/util/JDBCTypeConversions.java
  
  Index: JDBCTypeConversions.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/databases/java/org/apache/cocoon/util/JDBCTypeConversions.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JDBCTypeConversions.java	4 Apr 2003 13:19:07 -0000	1.3
  +++ JDBCTypeConversions.java	1 Jul 2003 11:29:55 -0000	1.4
  @@ -322,7 +322,7 @@
                   length = (int)((Source) value).getContentLength();
                   clob = new ClobHelper(asciiStream, length);
               } else {
  -                String asciiText = (String) value;
  +                String asciiText = value.toString();
                   asciiStream = new ByteArrayInputStream(asciiText.getBytes());
                   length = asciiText.length();
                   clob = new ClobHelper(asciiStream, length);
  @@ -350,7 +350,7 @@
                   length = (int) anyFile.getSize();
                   clob = new ClobHelper(asciiStream, length);
               } else {
  -                String asciiText = (String) value;
  +                String asciiText = value.toString();
                   asciiStream = new BufferedInputStream(new ByteArrayInputStream(asciiText.getBytes()));
                   length = asciiText.length();
               }
  @@ -366,7 +366,7 @@
               } else if (value instanceof Number) {
                   bd = BigDecimal.valueOf(((Number)value).longValue());
               } else {
  -                bd = new BigDecimal((String) value);
  +                bd = new BigDecimal(value.toString());
               }
               
               statement.setBigDecimal(position, bd);
  @@ -380,7 +380,7 @@
               } else if (value instanceof Number) {
                   b = new Byte(((Number) value).byteValue());
               } else {
  -                b = new Byte((String) value);
  +                b = new Byte(value.toString());
               }
               
               statement.setByte(position, b.byteValue());
  @@ -396,7 +396,7 @@
               } else if (value instanceof Calendar) {
                   d = new Date(((Calendar) value).getTime().getTime());
               } else {
  -                d = Date.valueOf(String.valueOf(value));
  +                d = Date.valueOf(value.toString());
               }
               
               statement.setDate(position, d);
  @@ -408,7 +408,7 @@
               if (value instanceof Number) {
                   db = (((Number) value).doubleValue());
               } else {
  -                db = Double.parseDouble(String.valueOf(value));
  +                db = Double.parseDouble(value.toString());
               }
               statement.setDouble(position, db);
               break;
  @@ -419,7 +419,7 @@
               if (value instanceof Number) {
                   f = (((Number) value).floatValue());
               } else {
  -                f = Float.parseFloat(String.valueOf(value));
  +                f = Float.parseFloat(value.toString());
               }
               statement.setFloat(position, f);
               break;
  @@ -430,7 +430,7 @@
               if (value instanceof Number) {
                   l = (((Number) value).longValue());
               } else {
  -                l = Long.parseLong(String.valueOf(value));
  +                l = Long.parseLong(value.toString());
               }
               
               statement.setLong(position, l);
  @@ -444,7 +444,7 @@
               } else if (value instanceof Number) {
                   s = new Short(((Number) value).shortValue());
               } else {
  -                s = new Short((String) value);
  +                s = new Short(value.toString());
               }
               
               statement.setShort(position, s.shortValue());
  @@ -493,7 +493,7 @@
               break;
           case Types.VARCHAR:
               //System.out.println("VARCHAR");
  -            statement.setString(position, (String) value);
  +            statement.setString(position, value.toString());
               break;
           case Types.BLOB:
               //System.out.println("BLOB");
  
  
  

Mime
View raw message