db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1029417 - /db/torque/village/trunk/src/java/com/workingdogs/village/Column.java
Date Sun, 31 Oct 2010 17:06:30 GMT
Author: tv
Date: Sun Oct 31 17:06:30 2010
New Revision: 1029417

URL: http://svn.apache.org/viewvc?rev=1029417&view=rev
Log:
Removed all methods from Column that are not actually used by Torque
Added a method to populate a column from given values

Modified:
    db/torque/village/trunk/src/java/com/workingdogs/village/Column.java

Modified: db/torque/village/trunk/src/java/com/workingdogs/village/Column.java
URL: http://svn.apache.org/viewvc/db/torque/village/trunk/src/java/com/workingdogs/village/Column.java?rev=1029417&r1=1029416&r2=1029417&view=diff
==============================================================================
--- db/torque/village/trunk/src/java/com/workingdogs/village/Column.java (original)
+++ db/torque/village/trunk/src/java/com/workingdogs/village/Column.java Sun Oct 31 17:06:30
2010
@@ -35,9 +35,6 @@ public class Column
     /** name of the column */
     private String name = "";
 
-    /** example: this column is of type "String" */
-    private String columnTypeName = "";
-
     /** what java.sql.Type is this column? */
     private int columnType = Types.LONGVARCHAR;
 
@@ -47,40 +44,19 @@ public class Column
     /** is null allowed for this column? */
     private boolean nullAllowed = false;
 
-    /** is this an auto increment column? */
-    private boolean autoIncrement = false;
-
     /** is this a read only column? */
     private boolean readOnly = false;
 
-    /** is this a searchable column? */
-    private boolean searchable = false;
-
-    /** what is the scale of this column? */
-    private int scale = -1;
-
-    /** what is the precision of this column? */
-    private int precision = -1;
-
-    /** what is the length of this column? */
-    private int length = -1;
-
     /**
      * constructor
      */
     public Column()
     {
         this.name = "";
-        this.columnTypeName = "";
         this.tableName = "";
         this.columnType = Types.LONGVARCHAR;
         this.nullAllowed = false;
-        this.autoIncrement = false;
         this.readOnly = false;
-        this.searchable = false;
-        this.scale = -1;
-        this.precision = -1;
-        this.length = -1;
     }
 
     /**
@@ -93,58 +69,43 @@ public class Column
      *
      * @throws SQLException TODO: DOCUMENT ME!
      */
-    void populate(ResultSetMetaData rsmd, int colNum, String tableName, String columnName)
+    public void populate(ResultSetMetaData rsmd, int colNum, String tableName, String columnName)
             throws SQLException
     {
         this.name = columnName;
         this.tableName = tableName;
 
-        this.columnTypeName = rsmd.getColumnTypeName(colNum);
         this.columnType = rsmd.getColumnType(colNum);
         this.nullAllowed = rsmd.isNullable(colNum) == 1;
-        this.autoIncrement = rsmd.isAutoIncrement(colNum);
-
-        // The JDBC spec is VERY unclear about what this means and as 
-        // such, it should be ignored.  Derby returns true all the time.
-        // Sybase and Informix say it's unsupported (and false).
-        this.readOnly = false; // rsmd.isReadOnly (colNum);
-        
-        this.searchable = rsmd.isSearchable(colNum);
-        this.scale = rsmd.getScale(colNum);
-
-        try
-        {
-            this.precision = rsmd.getPrecision(colNum);
-        }
-        catch (NumberFormatException assumedTooLarge)
-        {
-            // This may happen if the precision is too large for an
-            // int, with column types such as MySQL BIGINT, Oracle
-            // BLOB, etc..  See bug #4625851 at the JDC for details.
-            this.precision = Integer.MAX_VALUE;
-        }
-
-        this.length = rsmd.getColumnDisplaySize(colNum);
     }
-
+    
     /**
-     * the name of the column
+     * internal package method for populating a Column instance
+     *
+     * @param tableName The name of the table
+     * @param columnName The name of the column
+     * @param columnTypeName The Data source dependent type name
+     * @param columnType The SQL type from java.sql.Types
+     * @param isNullable true if NULL allowed.
      *
-     * @return the name of the column
      */
-    public String name()
+    public void populate(String tableName, String columnName, String columnTypeName, 
+            int columnType, boolean isNullable)
     {
-        return this.name;
+        this.name = columnName;
+        this.tableName = tableName;
+        this.columnType = columnType;
+        this.nullAllowed = isNullable;
     }
-
+    
     /**
-     * the data type of a column
+     * the name of the column
      *
-     * @return the java.sql.Types String
+     * @return the name of the column
      */
-    public String dbType()
+    public String name()
     {
-        return this.columnTypeName;
+        return this.name;
     }
 
     /**
@@ -168,16 +129,6 @@ public class Column
     }
 
     /**
-     * does this column auto increment?
-     *
-     * @return whether or not this column auto increments
-     */
-    public boolean autoIncrement()
-    {
-        return this.autoIncrement;
-    }
-
-    /**
      * is this column read only?
      *
      * @return whether or not this column is read only
@@ -188,46 +139,6 @@ public class Column
     }
 
     /**
-     * is this column searchable?
-     *
-     * @return true if this column is searchable
-     */
-    public boolean searchable()
-    {
-        return this.searchable;
-    }
-
-    /**
-     * the scale of the column
-     *
-     * @return the scale of the column
-     */
-    public int scale()
-    {
-        return this.scale;
-    }
-
-    /**
-     * the precision of the column
-     *
-     * @return the precision of the column
-     */
-    public int precision()
-    {
-        return this.precision;
-    }
-
-    /**
-     * the storage length of a column
-     *
-     * @return the storage length of a column
-     */
-    public int length()
-    {
-        return this.length;
-    }
-
-    /**
      * the type of the column as a string
      *
      * @return the type of the column as a string
@@ -463,58 +374,6 @@ public class Column
     }
 
     /**
-     * unknown use
-     *
-     * @return TODO: DOCUMENT ME!
-     *
-     * @throws DataSetException TODO: DOCUMENT ME!
-     */
-    public String dbKonaMethod()
-            throws DataSetException
-    {
-        throw new DataSetException("Method not implemented: Unknown use!");
-    }
-
-    /**
-     * unknown use
-     *
-     * @return TODO: DOCUMENT ME!
-     *
-     * @throws DataSetException TODO: DOCUMENT ME!
-     */
-    public String javaType()
-            throws DataSetException
-    {
-        throw new DataSetException("Method not implemented: Unknown use!");
-    }
-
-    /**
-     * unknown use
-     *
-     * @return TODO: DOCUMENT ME!
-     *
-     * @throws DataSetException TODO: DOCUMENT ME!
-     */
-    public final String preparedStatemntBindMethod()
-            throws DataSetException
-    {
-        throw new DataSetException("Method not implemented: Unknown use!");
-    }
-
-    /**
-     * unknown use
-     *
-     * @return TODO: DOCUMENT ME!
-     *
-     * @throws DataSetException TODO: DOCUMENT ME!
-     */
-    public final String resultSetMethod()
-            throws DataSetException
-    {
-        throw new DataSetException("Method not implemented: Unknown use!");
-    }
-
-    /**
      * TODO: DOCUMENT ME!
      *
      * @return TODO: DOCUMENT ME!



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message