diff options
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/jdbc1')
-rw-r--r-- | src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java index 47939a48103..0a28f7eb3ed 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java @@ -14,6 +14,7 @@ import java.sql.*; import org.postgresql.Field; import org.postgresql.largeobject.*; import org.postgresql.util.*; +import org.postgresql.core.Encoding; /** * A ResultSet provides access to a table of data generated by executing a @@ -154,26 +155,15 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu */ public String getString(int columnIndex) throws SQLException { - //byte[] bytes = getBytes(columnIndex); - // - //if (bytes == null) - //return null; - //return new String(bytes); if (columnIndex < 1 || columnIndex > fields.length) throw new PSQLException("postgresql.res.colrange"); + wasNullFlag = (this_row[columnIndex - 1] == null); if(wasNullFlag) return null; - String encoding = connection.getEncoding(); - if (encoding == null) - return new String(this_row[columnIndex - 1]); - else { - try { - return new String(this_row[columnIndex - 1], encoding); - } catch (UnsupportedEncodingException unse) { - throw new PSQLException("postgresql.res.encoding", unse); - } - } + + Encoding encoding = connection.getEncoding(); + return encoding.decode(this_row[columnIndex - 1]); } /** |