From: Peter T Mount <patches@maidast.demon.co.uk>
authorMarc G. Fournier <scrappy@hub.org>
Sun, 15 Mar 1998 07:12:07 +0000 (07:12 +0000)
committerMarc G. Fournier <scrappy@hub.org>
Sun, 15 Mar 1998 07:12:07 +0000 (07:12 +0000)
Ok, this fixes three things:

1. It seems (from tests submitted by two people with JBuilder) that
   JBuilder expects a responce from ResultSetMetaData.getPrecision() &
   getScale() when used on non numeric types. This patch makes these
   methods return 0, instead of throwing an exception.

2. Fixes a small bug where getting the postgresql type name returns null.

3. Fixes a problem with ResultSet.getObject() where getting it's string
   value returns null if you case the object as (PGobject), but returns
   the value if you case it as it's self.

src/interfaces/jdbc/postgresql/Field.java
src/interfaces/jdbc/postgresql/ResultSetMetaData.java
src/interfaces/jdbc/postgresql/util/PGobject.java

index 78553dd32ebad25aa37f84c00558f3adc1d900b0..dd8918e99b74e7aee1978f7003778bf7402924c1 100644 (file)
@@ -58,7 +58,8 @@ public class Field
       if (result.getColumnCount() != 1 || result.getTupleCount() != 1)
    throw new SQLException("Unexpected return from query for type");
       result.next();
-      sql_type = getSQLType(result.getString(1));
+      type_name = result.getString(1);
+      sql_type = getSQLType(type_name);
       result.close();
     }
     return sql_type;
index c4e54dbefaaaf1922d441008820d00dfb1439b11..fefd3bafdce182830ad43506be476f07b5ac2848 100644 (file)
@@ -266,7 +266,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
       case Types.DOUBLE:
    return 16;
       default:
-   throw new SQLException("no precision for non-numeric data types.");
+   return 0;
       }
   }
   
@@ -295,7 +295,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
       case Types.DOUBLE:
    return 16;
       default:
-   throw new SQLException("no scale for non-numeric data types");
+   return 0;
       }
   }
   
index 62b3d55f5ef491047ca7fb7d90e85df645d4517b..40e4daf4354875729a3bcba122153c5b732b02f7 100644 (file)
@@ -97,6 +97,6 @@ public class PGobject implements Serializable,Cloneable
    */
   public String toString()
   {
-    return value;
+    return getValue();
   }
 }