Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 31a925c

Browse files
committed
From: Peter T Mount <patches@maidast.demon.co.uk>
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.
1 parent 7eddade commit 31a925c

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/interfaces/jdbc/postgresql/Field.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ public int getSQLType() throws SQLException
5858
if (result.getColumnCount() != 1 || result.getTupleCount() != 1)
5959
throw new SQLException("Unexpected return from query for type");
6060
result.next();
61-
sql_type = getSQLType(result.getString(1));
61+
type_name = result.getString(1);
62+
sql_type = getSQLType(type_name);
6263
result.close();
6364
}
6465
return sql_type;

src/interfaces/jdbc/postgresql/ResultSetMetaData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public int getPrecision(int column) throws SQLException
266266
case Types.DOUBLE:
267267
return 16;
268268
default:
269-
throw new SQLException("no precision for non-numeric data types.");
269+
return 0;
270270
}
271271
}
272272

@@ -295,7 +295,7 @@ public int getScale(int column) throws SQLException
295295
case Types.DOUBLE:
296296
return 16;
297297
default:
298-
throw new SQLException("no scale for non-numeric data types");
298+
return 0;
299299
}
300300
}
301301

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,6 @@ public Object clone()
9797
*/
9898
public String toString()
9999
{
100-
return value;
100+
return getValue();
101101
}
102102
}

0 commit comments

Comments
 (0)