summaryrefslogtreecommitdiff
path: root/src/interfaces/jdbc/org/postgresql/ResultSet.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/ResultSet.java')
-rw-r--r--src/interfaces/jdbc/org/postgresql/ResultSet.java52
1 files changed, 38 insertions, 14 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/ResultSet.java b/src/interfaces/jdbc/org/postgresql/ResultSet.java
index cec62614ca4..bea07e639b1 100644
--- a/src/interfaces/jdbc/org/postgresql/ResultSet.java
+++ b/src/interfaces/jdbc/org/postgresql/ResultSet.java
@@ -25,11 +25,11 @@ public abstract class ResultSet
protected Connection connection; // the connection which we returned from
protected SQLWarning warnings = null; // The warning chain
protected boolean wasNullFlag = false; // the flag for wasNull()
-
+
// We can chain multiple resultSets together - this points to
// next resultSet in the chain.
protected ResultSet next = null;
-
+
/**
* Create a new ResultSet - Note that we create ResultSets to
* represent the results of everything.
@@ -52,8 +52,8 @@ public abstract class ResultSet
this.this_row = null;
this.current_row = -1;
}
-
-
+
+
/**
* Create a new ResultSet - Note that we create ResultSets to
* represent the results of everything.
@@ -69,7 +69,7 @@ public abstract class ResultSet
{
this(conn,fields,tuples,status,updateCount,0);
}
-
+
/**
* We at times need to know if the resultSet we are working
* with is the result of an UPDATE, DELETE or INSERT (in which
@@ -83,7 +83,7 @@ public abstract class ResultSet
{
return (fields != null);
}
-
+
/**
* Since ResultSets can be chained, we need some method of
* finding the next one in the chain. The method getNext()
@@ -95,7 +95,7 @@ public abstract class ResultSet
{
return (java.sql.ResultSet)next;
}
-
+
/**
* This following method allows us to add a ResultSet object
* to the end of the current chain.
@@ -109,7 +109,7 @@ public abstract class ResultSet
else
next.append(r);
}
-
+
/**
* If we are just a place holder for results, we still need
* to get an updateCount. This method returns it.
@@ -120,7 +120,7 @@ public abstract class ResultSet
{
return updateCount;
}
-
+
/**
* We also need to provide a couple of auxiliary functions for
* the implementation of the ResultMetaData functions. In
@@ -133,7 +133,7 @@ public abstract class ResultSet
{
return rows.size();
}
-
+
/**
* getColumnCount returns the number of columns
*
@@ -143,7 +143,7 @@ public abstract class ResultSet
{
return fields.length;
}
-
+
/**
* Returns the status message from the backend.<p>
* It is used internally by the driver.
@@ -154,7 +154,7 @@ public abstract class ResultSet
{
return status;
}
-
+
/**
* returns the OID of a field.<p>
* It is used internally by the driver.
@@ -166,7 +166,7 @@ public abstract class ResultSet
{
return fields[field-1].getOID();
}
-
+
/**
* returns the OID of the last inserted row
*/
@@ -174,12 +174,36 @@ public abstract class ResultSet
{
return insertOID;
}
-
+
/**
* This is part of the JDBC API, but is required by org.postgresql.Field
*/
public abstract void close() throws SQLException;
public abstract boolean next() throws SQLException;
public abstract String getString(int i) throws SQLException;
+
+ /**
+ * This is used to fix get*() methods on Money fields. It should only be
+ * used by those methods!
+ *
+ * It converts ($##.##) to -##.## and $##.## to ##.##
+ */
+ public String getFixedString(int col) throws SQLException {
+ String s = getString(col);
+
+ // Handle SQL Null
+ if(s==null)
+ return null;
+
+ // Handle Money
+ if(s.charAt(0)=='(') {
+ s="-"+org.postgresql.util.PGtokenizer.removePara(s).substring(1);
+ }
+ if(s.charAt(0)=='$') {
+ s=s.substring(1);
+ }
+
+ return s;
+ }
}