[prev in list] [next in list] [prev in thread] [next in thread] 

List:       avalon-dev
Subject:    cvs commit: jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport ResultSetMeta
From:       hammant () apache ! org
Date:       2001-10-31 16:06:24
[Download RAW message or body]

hammant     01/10/31 08:06:24

  Modified:    apps/db/src/java/org/apache/avalon/db/data Column.java
               apps/db/src/java/org/apache/avalon/db/data/impl
                        DefaultColumn.java
               apps/db/src/java/org/apache/avalon/db/driver
                        AvalonDBConnection.java AvalonDBResultSet.java
               apps/db/src/java/org/apache/avalon/db/results Columns.java
               apps/db/src/java/org/apache/avalon/db/transport Reply.java
                        ResultSetReply.java
  Added:       apps/db/src/java/org/apache/avalon/db/driver
                        AvalonDBResultSetMetaData.java
               apps/db/src/java/org/apache/avalon/db/transport
                        ResultSetMetaDataReply.java
  Log:
  Gerhard Froehlich's patches for JDBC driver
  
  Revision  Changes    Path
  1.4       +22 -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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Column.java	2001/10/30 17:45:14	1.3
  +++ Column.java	2001/10/31 16:06:23	1.4
  @@ -15,9 +15,30 @@
    *
    *
    * @author Paul Hammant <a \
                href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version * $Revision: 1.3 $
  + * @author Gerhard Froehlich <a \
href="mailto:g-froehlich@gmx.de">g-froehlich@gmx.de</a>  + * @version * $Revision: \
                1.4 $
    */
   public interface Column extends Nameable {
       String getSQLType();
       String getJavaType();
  +    int getColumnDisplaySize();
  +    String getColumnLabel();
  +    String getColumnName();
  +    int getColumnType();
  +    String getColumnTypeName();
  +    int getPrecision();
  +    int getScale();
  +    String getSchemaName();
  +    String getCatalogName();
  +    String getColumnClassName();
  +    String getTableName();
  +    boolean isAutoIncrement();
  +    boolean isCaseSensitive();
  +    boolean isCurrency();
  +    boolean isDefinitelyWritable();
  +    int isNullable();
  +    boolean isReadOnly();
  +    boolean isSearchable();
  +    boolean isSigned();
  +    boolean isWritable();
   }
  
  
  
  1.2       +100 -0    \
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultColumn.java
  
  Index: DefaultColumn.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultColumn.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultColumn.java	2001/10/30 17:45:14	1.1
  +++ DefaultColumn.java	2001/10/31 16:06:23	1.2
  @@ -20,7 +20,8 @@
    *
    *
    * @author Paul Hammant <a \
                href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.1 $
  + * @author Gerhard Froehlich <a \
href="mailto:g-froehlich@gmx.de">g-froehlich@gmx.de</a>*  + * @version $Revision: 1.2 \
                $
    */
   public class DefaultColumn implements Column {
   
  @@ -76,4 +77,103 @@
       public String getJavaType() {
           return mJavaType;
       }
  +
  +    /** methods for the metadata */
  +    public int getColumnDisplaySize() {
  +        //ToDo: implementation
  +        return 0;
  +    }
  +
  +    public String getColumnLabel() {
  +        return mName;
  +    }
  +
  +    public String getColumnName() {
  +        return mName;
  +    }
  +
  +    public int getColumnType() {
  +        //ToDo: implementation
  +        return 0;
  +    }
  +
  +    public String getColumnTypeName() {
  +        return mSqlType;
  +    }
  +
  +    public int getPrecision() {
  +        //ToDo: implementation
  +        return 0;
  +    }
  +
  +    public int getScale() {
  +        //ToDo: implementation
  +        return 0;
  +    }
  +
  +    public String getSchemaName() {
  +        //ToDo: implementation
  +        return null;
  +    }
  +
  +    public String getCatalogName() {
  +        //ToDo: implementation
  +        return null;
  +    }
  +
  +    public String getColumnClassName() {
  +        //ToDo: implementation
  +        return null;
  +    }
  +
  +    public String getTableName() {
  +        //ToDo: implementation
  +        return null;
  +    }
  +
  +    public boolean isAutoIncrement() {
  +        //ToDo: implementation
  +        return false;
  +    }
  +
  +    public boolean isCaseSensitive() {
  +        //ToDo: implementation
  +        return false;
  +    }
  +
  +    public boolean isCurrency() {
  +        //ToDo: implementation
  +        return false;
  +    }
  +
  +    public boolean isDefinitelyWritable() {
  +        //ToDo: implementation
  +        return false;
  +    }
  +
  +    public int isNullable() {
  +        //ToDo: implementation
  +        return 0;
  +    }
  +
  +    public boolean isReadOnly() {
  +        //ToDo: implementation
  +        return false;
  +    }
  +
  +    public boolean isSearchable() {
  +        //ToDo: implementation
  +        return false;
  +    }
  +
  +    public boolean isSigned() {
  +        //ToDo: implementation
  +        return false;
  +    }
  +
  +    public boolean isWritable() {
  +        //ToDo: implementation
  +        return false;
  +     }
  +
   }
  
  
  
  1.2       +3 -5      \
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/driver/AvalonDBConnection.java
  
  Index: AvalonDBConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/driver/AvalonDBConnection.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AvalonDBConnection.java	2001/10/31 09:39:53	1.1
  +++ AvalonDBConnection.java	2001/10/31 16:06:23	1.2
  @@ -22,7 +22,8 @@
    *
    *
    * @author Paul Hammant <a \
                href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.1 $
  + * @author Gerhard Froehlich <a \
href="mailto:g-froehlich@gmx.de">g-froehlich@gmx.de</a>  + * @version $Revision: 1.2 \
                $
    */
   public abstract class AvalonDBConnection extends AbstractDriver implements \
Connection {  
  @@ -243,10 +244,7 @@
        * @exception SQLException if a database access error occurs
        */
       public DatabaseMetaData getMetaData() throws SQLException {
  -
  -        debug();
  -
  -        return null;
  +        return new AvalonDBDatabaseMetaData();
       }
   
       /**
  
  
  
  1.2       +3 -5      \
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/driver/AvalonDBResultSet.java
  
  Index: AvalonDBResultSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/driver/AvalonDBResultSet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AvalonDBResultSet.java	2001/10/31 09:39:53	1.1
  +++ AvalonDBResultSet.java	2001/10/31 16:06:23	1.2
  @@ -31,7 +31,8 @@
    *
    *
    * @author Paul Hammant <a \
                href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.1 $
  + * @author Gerhard Froehlich <a \
href="mailto:g-froehlich@gmx.de">g-froehlich@gmx.de</a>  + * @version $Revision: 1.2 \
                $
    */
   public class AvalonDBResultSet extends AbstractDriver implements ResultSet {
   
  @@ -876,10 +877,7 @@
        * @exception SQLException if a database access error occurs
        */
       public ResultSetMetaData getMetaData() throws SQLException {
  -
  -        debug();
  -
  -        return null;
  +        return new AvalonDBResultSetMetaData(mAvalonDBConnection,mRowSet);
       }
   
       /**
  
  
  
  1.1                  \
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/driver/AvalonDBResultSetMetaData.java
  
  Index: AvalonDBResultSetMetaData.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.driver;
  
  import org.apache.avalon.db.common.FeatureNotImplemented;
  import org.apache.avalon.db.transport.ResultSetMetaDataReply;
  import org.apache.avalon.db.results.RowSet;
  import org.apache.avalon.db.results.Columns;
  import java.sql.ResultSetMetaData;
  import java.sql.SQLException;
  
  /**
   * Class AvalonDBResultSetMetaData
   *
   *
   * @author Gerhard Froehlich <a \
                href="mailto:g-froehlich@gmx.de">g-froehlich@gmx.de</a>
   */
  public class AvalonDBResultSetMetaData extends AbstractDriver implements \
ResultSetMetaData {  
      private AvalonDBConnection mAvalonDBConnection;
      private RowSet mRowSet;
       
      public AvalonDBResultSetMetaData(AvalonDBConnection apacheDBConnection, RowSet \
rowSet) {  mAvalonDBConnection = apacheDBConnection;
          mRowSet = rowSet;
      }
  
      /**
       * Gets the designated column's table's catalog name.
       */
      public String getCatalogName(int column) throws SQLException {
          return mRowSet.getColumns().getCatalogName(column);
      }
           
      /**
       * Returns the fully-qualified name of the Java class whose instances are 
       * manufactured if the method ResultSet.getObject is called to retrieve a value \
                
       * from the column.
       */
      public String getColumnClassName(int column) throws SQLException { 
          return mRowSet.getColumns().getColumnClassName(column);
      }
      
      /**
       * Returns the number of columns in this ResultSet object.
       */
      public int getColumnCount() throws SQLException {
          return mRowSet.getColumns().getColumnCount();
      }
      
      /**
       * Indicates the designated column's normal maximum width in characters.
       */
      public int getColumnDisplaySize(int column) throws SQLException {
          return mRowSet.getColumns().getColumnDisplaySize(column);
      }
      
      /**
       * Gets the designated column's suggested title for use in printouts and \
                displays.
       */
      public String getColumnLabel(int column) throws SQLException {
          return mRowSet.getColumns().getColumnLabel(column);
      }
      
      /**
       * Get the designated column's name.
       */
      public String getColumnName(int column) throws SQLException {
          return mRowSet.getColumns().getColumnName(column);
      }
      
      /**
       * Retrieves the designated column's SQL type.
       */
      public int getColumnType(int column) throws SQLException {
          return mRowSet.getColumns().getColumnType(column);
      }
            
      /**
       * Retrieves the designated column's database-specific type name.
       */
      public String getColumnTypeName(int column) throws SQLException {
          return mRowSet.getColumns().getColumnTypeName(column);
      }
            
      /**
       * Get the designated column's number of decimal digits.
       */
      public int getPrecision(int column) throws SQLException {
          return mRowSet.getColumns().getPrecision(column);
      }
      
      /**
       * Gets the designated column's number of digits to right of the decimal point.
       */
      public int getScale(int column) throws SQLException {
          return mRowSet.getColumns().getScale(column);
      }
      
      /**
       * Get the designated column's table's schema.
       */
      public String getSchemaName(int column) throws SQLException {
          return mRowSet.getColumns().getSchemaName(column);
      }
      
      /**
       * Gets the designated column's table name.
       */
      public String getTableName(int column) throws SQLException {
          return mRowSet.getColumns().getTableName(column);
      }
      
      /**
       * Indicates whether the designated column is automatically numbered, thus \
                read-only.
       */
      public boolean isAutoIncrement(int column) throws SQLException {
          return mRowSet.getColumns().isAutoIncrement(column);
      }
      
      /**
       * Indicates whether a column's case matters.
       */
      public boolean isCaseSensitive(int column) throws SQLException {
          return mRowSet.getColumns().isCaseSensitive(column);
      }
      
      /**
       * Indicates whether the designated column is a cash value.
       */
      public boolean isCurrency(int column) throws SQLException {
          return mRowSet.getColumns().isCurrency(column);
      }
         
      /**
       * Indicates whether a write on the designated column will definitely succeed.
       */   
      public boolean isDefinitelyWritable(int column) throws SQLException {
          return mRowSet.getColumns().isDefinitelyWritable(column);
      }
      
      /**
       * Indicates the nullability of values in the designated column.
       */
      public int isNullable(int column) throws SQLException {
          return mRowSet.getColumns().isNullable(column);
      }
      
      /**
       * Indicates whether the designated column is definitely not writable.
       */ 
      public boolean isReadOnly(int column) throws SQLException {
          return mRowSet.getColumns().isReadOnly(column);
      }
      
      /**
       * Indicates whether the designated column can be used in a where clause.
       */ 
      public boolean isSearchable(int column) throws SQLException {
          return mRowSet.getColumns().isSearchable(column);
      }
      
      /**
       * Indicates whether values in the designated column are signed numbers.
       */     
      public boolean isSigned(int column) throws SQLException {
          return mRowSet.getColumns().isSigned(column);
      }
      
      /**
       * Indicates whether it is possible for a write on the designated column to \
                succeed.
       */   
      public boolean isWritable(int column) throws SQLException {
          return mRowSet.getColumns().isWritable(column);
      }
  }
  
  
  1.2       +33 -6     \
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/results/Columns.java \
  Index: Columns.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/results/Columns.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Columns.java	2001/10/29 17:59:23	1.1
  +++ Columns.java	2001/10/31 16:06:23	1.2
  @@ -1,17 +1,44 @@
   /*
  - * Created by IntelliJ IDEA.
  - * User: Administrator
  - * Date: Oct 29, 2001
  - * Time: 5:24:50 PM
  - * To change template for new interface use 
  - * Code Style | Class Templates options (Tools | IDE Options).
  + * 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.results;
   
   import java.io.Serializable;
   
  +/**
  + * Interface Column
  + *
  + *
  + * @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>  + */
   public interface Columns extends Serializable {
       String[] getHeadings();
       String[] getTypes();
       int getIndex(String columnName);
  +    int getColumnDisplaySize(int column);
  +    String getColumnLabel(int column);
  +    String getColumnName(int column);
  +    int getColumnType(int column);
  +    String getColumnTypeName(int column);
  +    int getPrecision(int column);
  +    int getScale(int column);
  +    String getSchemaName(int column);
  +    String getCatalogName(int column);
  +    String getColumnClassName(int column);
  +    String getTableName(int column);
  +    boolean isAutoIncrement(int column);
  +    boolean isCaseSensitive(int column);
  +    boolean isCurrency(int column);
  +    boolean isDefinitelyWritable(int column);
  +    int isNullable(int column);
  +    boolean isReadOnly(int column);
  +    boolean isSearchable(int column);
  +    boolean isSigned(int column);
  +    boolean isWritable(int column);
  +    int getColumnCount();
   }
  
  
  
  1.6       +3 -2      \
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/Reply.java \
  Index: Reply.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/Reply.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Reply.java	2001/10/30 23:15:47	1.5
  +++ Reply.java	2001/10/31 16:06:23	1.6
  @@ -12,13 +12,12 @@
   
   import java.io.Serializable;
   
  -
   /**
    * Class Reply
    *
    *
    * @author Paul Hammant <a \
                href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public abstract class Reply implements Serializable {
   
  @@ -30,6 +29,8 @@
       public static final int TRANSACTIONISOLATIONREPLY = 15;
       public static final int CATALOGREPLY = 16;
       public static final int UPDATEREPLY = 17;
  +    public static final int RESULTSETMETADATA = 18;
  +
   
       private int mReplyCode;
   
  
  
  
  1.3       +1 -2      \
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/ResultSetReply.java
  
  Index: ResultSetReply.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/ResultSetReply.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResultSetReply.java	2001/10/29 15:18:16	1.2
  +++ ResultSetReply.java	2001/10/31 16:06:23	1.3
  @@ -12,13 +12,12 @@
   
   import org.apache.avalon.db.results.RowSet;
   
  -
   /**
    * Class ResultSetReply
    *
    *
    * @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 ResultSetReply extends Reply {
   
  
  
  
  1.1                  \
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/ResultSetMetaDataReply.java
  
  Index: ResultSetMetaDataReply.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.transport;
  
  import org.apache.avalon.db.results.RowSet;
  
  /**
   * Class ResultSetMetaDataReply
   *
   *
   * @author Gerhard Froehlich <a \
                href="mailto:g-froehlich@gmx.de">g-froehlich@gmx.de</a>
   */
  public class ResultSetMetaDataReply extends Reply {
  
      private RowSet mRowSet;
  
      /**
       * Constructor ResultSetMetaDataReply
       *
       *
       * @param rowSet
       *
       */
      public ResultSetMetaDataReply(RowSet rowSet) {
  
          super(Reply.RESULTSETMETADATA);
          this.mRowSet = rowSet;
      }
  
      public RowSet getRowSet() {
          return mRowSet;
      }
  }
  
  
  

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic