avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/types BooleanColumn.java SQLType.java
Date Thu, 20 Dec 2001 11:08:16 GMT
hammant     01/12/20 03:08:16

  Modified:    apps/db/src/java/org/apache/avalon/db/actions DropIndex.java
                        DropTable.java DropView.java
               apps/db/src/java/org/apache/avalon/db/basic/actions
                        BasicCreateQueryable.java BasicDropQueryable.java
               apps/db/src/java/org/apache/avalon/db/basic/handlers/lxsql
                        BasicLXSQLCreateViewHandler.java
                        BasicLXSQLQueryableHandler.java
               apps/db/src/java/org/apache/avalon/db/data Column.java
               apps/db/src/java/org/apache/avalon/db/data/impl
                        AbstractColumn.java AbstractDelegatedColumn.java
                        AbstractQueryable.java
                        DefaultDelegatedVarcharColumn.java
               apps/db/src/java/org/apache/avalon/db/data/types
                        SQLType.java
  Added:       apps/db/src/java/org/apache/avalon/db/actions
                        DropQueryable.java
               apps/db/src/java/org/apache/avalon/db/data/impl
                        DefaultBooleanColumn.java
                        DefaultDelegatedBooleanColumn.java
                        DefaultDelegatedNumericColumn.java
                        DefaultDelegatedTemporalColumn.java
               apps/db/src/java/org/apache/avalon/db/data/types
                        BooleanColumn.java
  Removed:     apps/db/src/java/org/apache/avalon/db/data/impl
                        DefaultDelegatedBigintColumn.java
                        DefaultDelegatedIntegerColumn.java
                        DefaultDelegatedSmallIntColumn.java
  Log:
  Added boolean column
  
  Revision  Changes    Path
  1.2       +1 -1      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/actions/DropIndex.java
  
  Index: DropIndex.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/actions/DropIndex.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DropIndex.java	2001/11/13 17:51:41	1.1
  +++ DropIndex.java	2001/12/20 11:08:15	1.2
  @@ -15,8 +15,8 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version * $Revision: 1.1 $
  + * @version * $Revision: 1.2 $
    */
  -public interface DropIndex extends Drop {
  +public interface DropIndex extends DropQueryable {
   
   }
  
  
  
  1.2       +1 -1      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/actions/DropTable.java
  
  Index: DropTable.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/actions/DropTable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DropTable.java	2001/11/13 17:51:41	1.1
  +++ DropTable.java	2001/12/20 11:08:15	1.2
  @@ -15,8 +15,8 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version * $Revision: 1.1 $
  + * @version * $Revision: 1.2 $
    */
  -public interface DropTable extends Drop {
  +public interface DropTable extends DropQueryable {
   
   }
  
  
  
  1.2       +1 -1      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/actions/DropView.java
  
  Index: DropView.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/actions/DropView.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DropView.java	2001/11/13 17:51:41	1.1
  +++ DropView.java	2001/12/20 11:08:15	1.2
  @@ -15,8 +15,8 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version * $Revision: 1.1 $
  + * @version * $Revision: 1.2 $
    */
  -public interface DropView extends Drop {
  +public interface DropView extends DropQueryable {
   
   }
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/actions/DropQueryable.java
  
  Index: DropQueryable.java
  ===================================================================
  
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.actions;
  
  
  
  /**
   * Interface DropQueryable
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version * $Revision: 1.1 $
   */
  public interface DropQueryable extends Drop {
  
  }
  
  
  
  1.11      +1 -2      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/actions/BasicCreateQueryable.java
  
  Index: BasicCreateQueryable.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/actions/BasicCreateQueryable.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- BasicCreateQueryable.java	2001/11/29 00:50:02	1.10
  +++ BasicCreateQueryable.java	2001/12/20 11:08:15	1.11
  @@ -14,7 +14,6 @@
   import org.apache.avalon.db.data.Column;
   import org.apache.avalon.db.data.Table;
   import org.apache.avalon.db.data.impl.AbstractColumn;
  -import org.apache.avalon.db.data.impl.DefaultVarCharColumn;
   import org.apache.avalon.db.data.impl.DefaultIntegerColumn;
   import org.apache.avalon.db.data.impl.DefaultDateColumn;
   import org.apache.avalon.db.data.impl.DefaultTimeColumn;
  @@ -34,7 +33,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.10 $
  + * @version $Revision: 1.11 $
    */
   public abstract class BasicCreateQueryable extends AbstractAction implements CreateTable
{
   
  
  
  
  1.3       +5 -17     jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/actions/BasicDropQueryable.java
  
  Index: BasicDropQueryable.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/actions/BasicDropQueryable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BasicDropQueryable.java	2001/11/29 00:50:02	1.2
  +++ BasicDropQueryable.java	2001/12/20 11:08:15	1.3
  @@ -8,23 +8,11 @@
    */
   package org.apache.avalon.db.basic.actions;
   
  +
  +import org.apache.avalon.db.actions.impl.AbstractAction;
   import org.apache.avalon.db.actions.CreateTable;
   import org.apache.avalon.db.actions.ActionException;
  -import org.apache.avalon.db.actions.impl.AbstractAction;
  -import org.apache.avalon.db.data.Column;
  -import org.apache.avalon.db.data.Table;
  -import org.apache.avalon.db.data.impl.AbstractColumn;
  -import org.apache.avalon.db.data.impl.DefaultVarCharColumn;
  -import org.apache.avalon.db.data.impl.DefaultIntegerColumn;
  -import org.apache.avalon.db.data.impl.DefaultDateColumn;
  -import org.apache.avalon.db.data.impl.DefaultTimeColumn;
  -import org.apache.avalon.db.data.impl.DefaultTimestampColumn;
  -import org.apache.avalon.db.data.impl.DefaultSmallIntColumn;
  -import org.apache.avalon.db.data.impl.DefaultRealColumn;
  -import org.apache.avalon.db.data.impl.DefaultBigIntColumn;
  -import org.apache.avalon.db.data.impl.DefaultDecimalColumn;
  -import org.apache.avalon.db.basic.data.BasicTable;
  -import org.apache.avalon.db.services.DatabasePersistor;
  +import org.apache.avalon.db.actions.DropQueryable;
   
   import java.util.Vector;
   
  @@ -34,9 +22,9 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
  -public abstract class BasicDropQueryable extends AbstractAction implements CreateTable
{
  +public abstract class BasicDropQueryable extends AbstractAction implements DropQueryable
{
   
       protected String mQueryableName;
       private int mRecordCount;
  
  
  
  1.14      +15 -9     jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/handlers/lxsql/BasicLXSQLCreateViewHandler.java
  
  Index: BasicLXSQLCreateViewHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/handlers/lxsql/BasicLXSQLCreateViewHandler.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- BasicLXSQLCreateViewHandler.java	2001/12/19 10:45:45	1.13
  +++ BasicLXSQLCreateViewHandler.java	2001/12/20 11:08:16	1.14
  @@ -23,9 +23,11 @@
   import org.apache.avalon.db.data.Column;
   import org.apache.avalon.db.data.types.NumericColumn;
   import org.apache.avalon.db.data.types.StringColumn;
  +import org.apache.avalon.db.data.types.TemporalColumn;
   import org.apache.avalon.db.data.impl.AbstractQueryable;
   import org.apache.avalon.db.data.impl.DefaultDelegatedVarcharColumn;
  -import org.apache.avalon.db.data.impl.DefaultDelegatedIntegerColumn;
  +import org.apache.avalon.db.data.impl.DefaultDelegatedNumericColumn;
  +import org.apache.avalon.db.data.impl.DefaultDelegatedTemporalColumn;
   import org.apache.avalon.db.server.DBRequestContext;
   
   import org.w3c.dom.Document;
  @@ -41,7 +43,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.13 $
  + * @version $Revision: 1.14 $
    */
   public class BasicLXSQLCreateViewHandler extends BasicLXSQLHandler {
   
  @@ -139,16 +141,20 @@
   
       }
   
  -    protected Column createDelegatedColumn(AbstractQueryable queryable, ContrivedColumnNameHolder
colHldr, Node columnNode, int ix) throws ActionException {
  +    protected Column createDelegatedColumn(AbstractQueryable queryable,
  +            ContrivedColumnNameHolder colHldr, Node columnNode, int ix) throws ActionException
{
           Column col = mSelectColumnHelper.getSelectColumn(queryable, (Element) columnNode,
colHldr);
           Column column = null;
  -        if (col instanceof StringColumn) {
  -            column = new DefaultDelegatedVarcharColumn((StringColumn)col,null);
  -        } else if (col instanceof NumericColumn) {
  -            //TODO
  -            column = new DefaultDelegatedIntegerColumn((NumericColumn)col,null);
  +        if (queryable.containsColumn(col)) {
  +            if (col instanceof StringColumn) {
  +                column = new DefaultDelegatedVarcharColumn((StringColumn)col,null);
  +            } else if (col instanceof NumericColumn) {
  +                column = new DefaultDelegatedNumericColumn((NumericColumn)col,null);
  +            } else if (col instanceof TemporalColumn) {
  +                column = new DefaultDelegatedTemporalColumn((TemporalColumn)col,null);
  +            } // TODO boolean & other types ?
           } else {
  -            //TODO
  +            column = col;
           }
           column.setIndex(ix);
           return column;
  
  
  
  1.8       +5 -2      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/handlers/lxsql/BasicLXSQLQueryableHandler.java
  
  Index: BasicLXSQLQueryableHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/handlers/lxsql/BasicLXSQLQueryableHandler.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- BasicLXSQLQueryableHandler.java	2001/12/19 10:45:45	1.7
  +++ BasicLXSQLQueryableHandler.java	2001/12/20 11:08:16	1.8
  @@ -24,7 +24,8 @@
   import org.apache.avalon.db.data.impl.DefaultDecimalColumn;
   import org.apache.avalon.db.data.impl.AbstractQueryable;
   import org.apache.avalon.db.data.impl.DefaultDelegatedVarcharColumn;
  -import org.apache.avalon.db.data.impl.DefaultDelegatedIntegerColumn;
  +import org.apache.avalon.db.data.impl.DefaultDelegatedNumericColumn;
  +import org.apache.avalon.db.data.impl.DefaultBooleanColumn;
   import org.apache.avalon.db.actions.ActionException;
   import org.w3c.dom.Element;
   import org.w3c.dom.NodeList;
  @@ -39,7 +40,7 @@
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
    * @author Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">g-froehlich@gmx.de</a>
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public abstract class BasicLXSQLQueryableHandler extends BasicLXSQLHandler {
   
  @@ -120,6 +121,8 @@
               column= new DefaultBigIntColumn(fieldName);
           } else if (sqlFieldType.equals("decimal")) {
               column= new DefaultDecimalColumn(fieldName);
  +        } else if (sqlFieldType.equals("boolean")) {
  +            column= new DefaultBooleanColumn(fieldName);
           } else {
               throw new ActionException("Column type " + sqlFieldType + " not recognised");
           }
  
  
  
  1.13      +2 -1      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/Column.java
  
  Index: Column.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/Column.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Column.java	2001/12/19 18:59:26	1.12
  +++ Column.java	2001/12/20 11:08:16	1.13
  @@ -18,7 +18,7 @@
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
    * @author Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">g-froehlich@gmx.de</a>
  - * @version * $Revision: 1.12 $
  + * @version * $Revision: 1.13 $
    */
   public interface Column extends Nameable {
   
  @@ -63,6 +63,7 @@
       int PREC_TIMESTAMP = 9;
       int PREC_DATE = 10;
       int PREC_NUMERIC_CONST = 11;
  +    int PREC_BOOLEAN = 12;
   
       Integer toInteger(Row row);
       Long toLong(Row row);
  
  
  
  1.7       +2 -3      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/AbstractColumn.java
  
  Index: AbstractColumn.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/AbstractColumn.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractColumn.java	2001/12/19 18:59:26	1.6
  +++ AbstractColumn.java	2001/12/20 11:08:16	1.7
  @@ -24,7 +24,7 @@
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
    * @author Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">g-froehlich@gmx.de</a>*
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    */
   public abstract class AbstractColumn implements Column {
   
  @@ -92,8 +92,7 @@
       }
   
       public int getColumnType() {
  -        //ToDo: implementation
  -        return 0;
  +        return mSqlType.getJDBCType();
       }
   
       public String getColumnTypeName() {
  
  
  
  1.3       +113 -5    jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/AbstractDelegatedColumn.java
  
  Index: AbstractDelegatedColumn.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/AbstractDelegatedColumn.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractDelegatedColumn.java	2001/12/19 18:59:26	1.2
  +++ AbstractDelegatedColumn.java	2001/12/20 11:08:16	1.3
  @@ -21,12 +21,13 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
  -public class AbstractDelegatedColumn extends AbstractColumn {
  +public class AbstractDelegatedColumn implements Column {
   
       protected String mAlias;
       protected Column mColumn;
  +    protected int mIndex;
   
       /**
        * Constructor AbstractDelegatedColumn
  @@ -35,8 +36,7 @@
        * @param name
        *
        */
  -    public AbstractDelegatedColumn(Column column, String alias, SQLType sqlType) throws
ActionException {
  -        super(column.getName(), sqlType);
  +    public AbstractDelegatedColumn(Column column, String alias) throws ActionException
{
           mAlias = alias;
           mColumn = column;
       }
  @@ -45,7 +45,6 @@
           return mColumn.getValue(row);
       }
   
  -
       public Integer toInteger(Row row) {
           return mColumn.toInteger(row);
       }
  @@ -73,4 +72,113 @@
       public int getPrecesion() {
           return mColumn.getPrecesion();
       }
  +
  +     public void setIndex(int ix) {
  +         mIndex = ix;
  +     }
  +
  +     /**
  +      * Method getSQLType
  +      *
  +      *
  +      * @return
  +      *
  +      */
  +     public SQLType getSQLType() {
  +         return mColumn.getSQLType();
  +     }
  +
  +     /**
  +      * Method getName
  +      *
  +      *
  +      * @return
  +      *
  +      */
  +     public String getName() {
  +         return mAlias;
  +     }
  +
  +
  +     /** methods for the metadata */
  +     public int getColumnDisplaySize() {
  +         return mColumn.getColumnDisplaySize();
  +     }
  +
  +     public String getColumnLabel() {
  +         return mColumn.getColumnLabel();
  +     }
  +
  +     public String getColumnName() {
  +         return mAlias;
  +     }
  +
  +     public int getColumnType() {
  +         return mColumn.getColumnType();
  +     }
  +
  +     public String getColumnTypeName() {
  +         return mColumn.getColumnTypeName();
  +     }
  +
  +     public int getPrecision() {
  +         return mColumn.getPrecision();
  +     }
  +
  +     public int getScale() {
  +         return mColumn.getScale();
  +     }
  +
  +     public String getSchemaName() {
  +         return mColumn.getSchemaName();
  +     }
  +
  +     public String getCatalogName() {
  +         return mColumn.getCatalogName();
  +     }
  +
  +     public String getColumnClassName() {
  +         return mColumn.getColumnClassName();
  +     }
  +
  +     public String getTableName() {
  +         return mColumn.getTableName();
  +     }
  +
  +     public boolean isAutoIncrement() {
  +         return mColumn.isAutoIncrement();
  +     }
  +
  +     public boolean isCaseSensitive() {
  +         return mColumn.isCaseSensitive();
  +     }
  +
  +     public boolean isCurrency() {
  +         return mColumn.isCurrency();
  +     }
  +
  +     public boolean isDefinitelyWritable() {
  +         return mColumn.isDefinitelyWritable();
  +     }
  +
  +     public int isNullable() {
  +         return mColumn.isNullable();
  +     }
  +
  +     public boolean isReadOnly() {
  +         return mColumn.isReadOnly();
  +     }
  +
  +     public boolean isSearchable() {
  +         return mColumn.isSearchable();
  +     }
  +
  +     public boolean isSigned() {
  +         return mColumn.isSigned();
  +     }
  +
  +     public boolean isWritable() {
  +         return mColumn.isWritable();
  +     }
  +
   }
  
  
  
  1.14      +9 -2      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/AbstractQueryable.java
  
  Index: AbstractQueryable.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/AbstractQueryable.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- AbstractQueryable.java	2001/12/17 16:10:00	1.13
  +++ AbstractQueryable.java	2001/12/20 11:08:16	1.14
  @@ -26,7 +26,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.13 $
  + * @version $Revision: 1.14 $
    */
   public abstract class AbstractQueryable extends AbstractNameable implements Queryable {
   
  @@ -208,5 +208,12 @@
           }
       }
   
  -
  +    public boolean containsColumn(Column column) {
  +        for (int x = 0; x < mColumns.length; x++) {
  +            if (mColumns[x] == column) {
  +                return true;
  +            }
  +        }
  +        return false;
  +    }
   }
  
  
  
  1.3       +2 -2      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultDelegatedVarcharColumn.java
  
  Index: DefaultDelegatedVarcharColumn.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultDelegatedVarcharColumn.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultDelegatedVarcharColumn.java	2001/12/19 18:59:26	1.2
  +++ DefaultDelegatedVarcharColumn.java	2001/12/20 11:08:16	1.3
  @@ -17,7 +17,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class DefaultDelegatedVarcharColumn extends AbstractDelegatedColumn implements StringColumn
{
   
  @@ -30,7 +30,7 @@
        *
        */
       public DefaultDelegatedVarcharColumn(StringColumn stringColumn, String alias) throws
ActionException {
  -        super(stringColumn, alias, SQLType.VARCHAR);
  +        super(stringColumn, alias);
       }
   
       public int getMaxLength() {
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultBooleanColumn.java
  
  Index: DefaultBooleanColumn.java
  ===================================================================
  
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.data.impl;
  
  import org.apache.avalon.db.data.ValidationException;
  import org.apache.avalon.db.data.Row;
  import org.apache.avalon.db.data.Column;
  import org.apache.avalon.db.data.types.SQLType;
  import org.apache.avalon.db.data.types.BooleanColumn;
  import org.apache.avalon.db.utils.StringUtils;
  import java.math.BigDecimal;
  
  
  /**
   * Class DefaultBooleanColumn
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @author Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">g-froehlich@gmx.de</a>*
   * @version $Revision: 1.1 $
   */
  public class DefaultBooleanColumn extends AbstractWritableColumn implements BooleanColumn
{
  
      /**
       * Constructor DefaultBooleanColumn
       *
       *
       * @param name
       * @param maxLength
       *
       */
      public DefaultBooleanColumn(String name) {
          super(name, SQLType.BOOLEAN);
      }
  
      public Object convertFromObject(Object obj) throws ValidationException {
          if (obj instanceof String) {
            return Boolean.valueOf(obj.toString());
          } else if (obj instanceof Boolean) {
              return obj;
          } else {
              throw new ValidationException("Boolean " + mName + " is not passed up as String
or Boolean");
          }
      }
  
      public Object getValue(Row row) {
          return row.getValue(mIndex);
      }
  
      public String toString(Row row) {
          return row.getValue(mIndex).toString();
      }
  
      private static Integer INT_TRUE = new Integer(1);
      private static Integer INT_FALSE = new Integer(0);
      public Integer toInteger(Row row) {
          return getBooleanValue(row) ? INT_TRUE : INT_FALSE;
      }
  
      private static Long LONG_TRUE = new Long(1);
      private static Long LONG_FALSE = new Long(0);
      public Long toLong(Row row) {
          return getBooleanValue(row) ? LONG_TRUE : LONG_FALSE;
      }
  
      private static BigDecimal BD_TRUE = new BigDecimal(1);
      private static BigDecimal BD_FALSE = new BigDecimal(0);
      public BigDecimal toBigDecimal(Row row) {
          return getBooleanValue(row) ? BD_TRUE : BD_FALSE;
      }
  
      private static Float FLOAT_TRUE = new Float(1);
      private static Float FLOAT_FALSE = new Float(0);
      public Float toFloat(Row row) {
          return getBooleanValue(row) ? FLOAT_TRUE : FLOAT_FALSE;
      }
  
      private static Short SHORT_TRUE = new Short((short)1);
      private static Short SHORT_FALSE = new Short((short)0);
      public Short toShort(Row row) {
          return getBooleanValue(row) ? SHORT_TRUE : SHORT_FALSE;
      }
  
      public int getPrecesion() {
          return Column.PREC_STRING;
      }
  
      public boolean getBooleanValue(Row row) {
          Boolean boo = (Boolean) getValue(row);
          return boo.booleanValue();
      }
  
  
  }
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultDelegatedBooleanColumn.java
  
  Index: DefaultDelegatedBooleanColumn.java
  ===================================================================
  
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.data.impl;
  
  import org.apache.avalon.db.data.types.SQLType;
  import org.apache.avalon.db.data.types.BooleanColumn;
  import org.apache.avalon.db.data.Row;
  import org.apache.avalon.db.actions.ActionException;
  
  /**
   * Class DefaultDelegatedBooleanColumn
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class DefaultDelegatedBooleanColumn extends AbstractDelegatedColumn implements BooleanColumn
{
  
  
      /**
       * Constructor DefaultDelegatedBooleanColumn
       *
       *
       * @param name
       *
       */
      public DefaultDelegatedBooleanColumn(BooleanColumn booleanColumn, String alias) throws
ActionException {
          super(booleanColumn, alias);
      }
  
      public boolean getBooleanValue(Row row) {
          return ((BooleanColumn) mColumn).getBooleanValue(row);
      }
  
  }
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultDelegatedNumericColumn.java
  
  Index: DefaultDelegatedNumericColumn.java
  ===================================================================
  
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.data.impl;
  
  import org.apache.avalon.db.data.types.NumericColumn;
  import org.apache.avalon.db.data.types.SQLType;
  import org.apache.avalon.db.actions.ActionException;
  
  /**
   * Class DefaultDelegatedNumericColumn
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class DefaultDelegatedNumericColumn extends AbstractDelegatedColumn implements NumericColumn
{
  
  
      /**
       * Constructor DefaultDelegatedNumericColumn
       *
       *
       * @param name
       *
       */
      public DefaultDelegatedNumericColumn(NumericColumn numericColumn, String alias) throws
ActionException {
          super(numericColumn, alias);
      }
  
  }
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultDelegatedTemporalColumn.java
  
  Index: DefaultDelegatedTemporalColumn.java
  ===================================================================
  
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.data.impl;
  
  import org.apache.avalon.db.data.types.SQLType;
  import org.apache.avalon.db.data.types.TemporalColumn;
  import org.apache.avalon.db.actions.ActionException;
  
  import java.math.BigDecimal;
  
  /**
   * Class DefaultDelegatedTemporalColumn
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class DefaultDelegatedTemporalColumn extends AbstractDelegatedColumn implements TemporalColumn
{
  
  
      /**
       * Constructor DefaultDelegatedTemporalColumn
       *
       *
       * @param name
       *
       */
      public DefaultDelegatedTemporalColumn(TemporalColumn temporalColumn, String alias) throws
ActionException {
          super(temporalColumn, alias);
      }
  
  }
  
  
  
  1.2       +4 -1      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/types/SQLType.java
  
  Index: SQLType.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/types/SQLType.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SQLType.java	2001/12/19 18:59:27	1.1
  +++ SQLType.java	2001/12/20 11:08:16	1.2
  @@ -33,12 +33,15 @@
   
       public static final SQLType VARCHAR = new SQLType("varchar", String.class, Types.VARCHAR);
   
  -    // date types
  +    // temporal types
   
       public static final SQLType DATE = new SQLType("date", Date.class, Types.DATE);
       public static final SQLType TIME = new SQLType("time", Time.class, Types.TIME);
       public static final SQLType TIMESTAMP = new SQLType("timestamp", Timestamp.class, Types.TIMESTAMP);
   
  +    // temporal types
  +
  +    public static final SQLType BOOLEAN = new SQLType("boolean", Boolean.class, Types.BOOLEAN);
   
   
       private String mSqlType;
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/types/BooleanColumn.java
  
  Index: BooleanColumn.java
  ===================================================================
  
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.data.types;
  
  import org.apache.avalon.db.data.Column;
  import org.apache.avalon.db.data.Row;
  
  
  /**
   * Class StringColumn
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public interface BooleanColumn extends Column {
      boolean getBooleanValue(Row row);
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message