jstrachan    2002/10/28 08:14:55

  Modified:    sql/src/java/org/apache/commons/sql/io MetadataReader.java
  Log:
  applied J. Russell Smyth 's patches
  
  Modified to still build/run with my changes. This class is 
  absolutely incomplete - hardcoded schema names, comments from
  the code from which it was copied, etc. See other message.
  
  Could maybe remove this class and just use the new JdbcModelReader instead
  
  Revision  Changes    Path
  1.3       +35 -28    
jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/io/MetadataReader.java
  
  Index: MetadataReader.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/io/MetadataReader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MetadataReader.java       23 Oct 2002 10:16:48 -0000      1.2
  +++ MetadataReader.java       28 Oct 2002 16:14:55 -0000      1.3
  @@ -194,46 +194,53 @@
               while (columnSet.next())
               {
                   String name = columnSet.getString(4);
  -                Integer sqlType = new Integer(columnSet.getInt(5));
  +//                Integer sqlType = new Integer(columnSet.getInt(5));
  +                int sqlType = columnSet.getInt(5);
                   String typeName = columnSet.getString(6);
                   int size = columnSet.getInt(7);
  -                String scale = columnSet.getString(9);
  -                String precisionRadix = columnSet.getString(10);
  +//                String scale = columnSet.getString(9);
  +//                String precisionRadix = columnSet.getString(10);
  +                int scale = columnSet.getInt(9);
  +                int precisionRadix = columnSet.getInt(10);
                   int nullable = columnSet.getInt(11);
                   String remarks = columnSet.getString(12);
                   String defValue = columnSet.getString(13);
                   String charOctetLength = columnSet.getString(16);
  -                String ordinalPosition = columnSet.getString(17);
  +//                String ordinalPosition = columnSet.getString(17);
  +                int ordinalPosition = columnSet.getInt(17);
                   String isNullable = columnSet.getString(18);
   
                   Column column = new Column();
                   column.setName(name);
  -                column.setType(TypeMap.getSQLTypeString(sqlType));
  -                if(TypeMap.isTextType(TypeMap.getSQLTypeString(sqlType)))
  -                {
  -                    column.setIsTextType(new Boolean(true));
  -                }
  +//                column.setType(TypeMap.getSQLTypeString(sqlType));
  +                column.setTypeCode(sqlType);
  +//                if(TypeMap.isTextType(TypeMap.getSQLTypeString(sqlType)))
  +//                {
  +//                    column.setIsTextType(new Boolean(true));
  +//                }
                   
                   column.setSize(size);
  -                if(scale != null)
  -                {
  -                    column.setScale(new Integer(scale));
  -                }
  -                if(precisionRadix != null)
  -                {
  -                    column.setPrecisionRadix(Integer.getInteger(precisionRadix));
  -                }
  -                column.setNullable((nullable == 1) ? true : false);
  +//                if(scale != null)
  +//                {
  +//                    column.setScale(new Integer(scale));
  +                    column.setScale(scale);
  +//                }
  +//                if(precisionRadix != null)
  +//                {
  +//                    column.setPrecisionRadix(Integer.getInteger(precisionRadix));
  +                    column.setPrecisionRadix(precisionRadix);
  +//                }
  +//                column.setNullable((nullable == 1) ? true : false);
                   column.setDefaultValue(defValue);
  -                if(charOctetLength != null)
  -                {
  -                    column.setCharOctetLength(Integer.getInteger(charOctetLength));
  -                }
  -                if(ordinalPosition != null)
  -                {
  -                    column.setOrdinalPosition(Integer.getInteger(ordinalPosition));
  -                }
  -                column.setIsNullable(isNullable);
  +//                if(charOctetLength != null)
  +//                {
  +//                    
column.setCharOctetLength(Integer.getInteger(charOctetLength));
  +//                }
  +//                if(ordinalPosition != null)
  +//                {
  +                    column.setOrdinalPosition(ordinalPosition);
  +//                }
  +//                column.setIsNullable(isNullable);
                   /*
                   List col = new Vector(5);
                   col.add(name);
  
  
  

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

Reply via email to