You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ha...@apache.org on 2001/11/19 16:51:55 UTC

cvs commit: xml-cocoon2/src/org/apache/cocoon/acting AbstractDatabaseAction.java

haul        01/11/19 07:51:55

  Modified:    src/org/apache/cocoon/acting AbstractDatabaseAction.java
  Log:
  - made typeConstants protected (was private) since I'd
    like to access it from a child class (to overwrite
    getColumn)
  - added support for Array, Struct, and Object
  
  Revision  Changes    Path
  1.14      +21 -5     xml-cocoon2/src/org/apache/cocoon/acting/AbstractDatabaseAction.java
  
  Index: AbstractDatabaseAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/AbstractDatabaseAction.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- AbstractDatabaseAction.java	2001/10/11 07:28:15	1.13
  +++ AbstractDatabaseAction.java	2001/11/19 15:51:54	1.14
  @@ -147,11 +147,11 @@
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
    * @author <a href="mailto:balld@apache.org">Donald Ball</a>
  - * @version CVS $Revision: 1.13 $ $Date: 2001/10/11 07:28:15 $
  + * @version CVS $Revision: 1.14 $ $Date: 2001/11/19 15:51:54 $
    */
   public abstract class AbstractDatabaseAction extends AbstractComplementaryConfigurableAction implements Configurable, Disposable {
       protected Map files = new HashMap();
  -    private static final Map typeConstants;
  +    protected static final Map typeConstants;
       protected ComponentSelector dbselector;
   
       static {
  @@ -172,7 +172,7 @@
           constants.put("short", new Integer(Types.SMALLINT));
           constants.put("time", new Integer(Types.TIME));
           constants.put("time-stamp", new Integer(Types.TIMESTAMP));
  -        constants.put("now", new Integer(Types.OTHER));
  +        constants.put("now", new Integer(Types.LONGVARBINARY));
           //constants.put("image", new Integer(Types.DISTINCT));
           //constants.put("image-width", new Integer(Types.ARRAY));
           //constants.put("image-height", new Integer(Types.BIT));
  @@ -183,6 +183,9 @@
           constants.put("image-size",new Integer(Types.INTEGER));
           constants.put("row-index",new Integer(Types.INTEGER));
           constants.put("image-mime-type",new Integer(Types.VARCHAR));
  +        constants.put("array", new Integer(Types.ARRAY));
  +        constants.put("row", new Integer(Types.STRUCT));
  +        constants.put("object", new Integer(Types.OTHER));
           typeConstants = Collections.unmodifiableMap(constants);
       }
   
  @@ -269,7 +272,7 @@
                   value = set.getTimestamp(dbcol);
                   break;
               case Types.ARRAY:
  -                value = new Integer(set.getInt(dbcol));
  +                value = set.getArray(dbcol);
                   break;
               case Types.BIT:
                   value = new Integer(set.getInt(dbcol));
  @@ -277,6 +280,13 @@
               case Types.CHAR:
                   value = new Integer(set.getInt(dbcol));
                   break;
  +	    case Types.STRUCT:
  +		value = (Struct) set.getObject(dbcol);
  +		break;
  +	    case Types.OTHER:
  +		value = set.getObject(dbcol);
  +		break;
  +
               default:
                   // The blob types have to be requested separately, via a Reader.
                   value = "";
  @@ -513,9 +523,15 @@
   
                   statement.setTimestamp(position, ts);
                   break;
  +	    case Types.ARRAY:
  +		statement.setArray(position, (Array) value); // no way to convert string to array
  +		break;
  +	    case Types.STRUCT:
               case Types.OTHER:
  -                statement.setTimestamp(position, new Timestamp((new java.util.Date()).getTime()));
  +		statement.setObject(position, value);
                   break;
  +	    case Types.LONGVARBINARY:
  +                statement.setTimestamp(position, new Timestamp((new java.util.Date()).getTime()));
               case Types.VARCHAR:
                   if ("string".equals(typeName)) {
                       statement.setString(position, (String) value);
  
  
  

----------------------------------------------------------------------
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