diff options
author | Barry Lind <barry@xythos.com> | 2003-02-09 23:14:55 +0000 |
---|---|---|
committer | Barry Lind <barry@xythos.com> | 2003-02-09 23:14:55 +0000 |
commit | abcec0c12513ff6ec87cb946bf66a78169acde9c (patch) | |
tree | 2ea2cf6905f904366a587f3ff24796619064a4a8 /src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java | |
parent | 39b7ec330923b5a2746720101fbd83c1dd418aea (diff) | |
download | postgresql-abcec0c12513ff6ec87cb946bf66a78169acde9c.tar.gz |
Better error message on character set mismatches during conversion to unicode.
Also applied patch from Lars Stenberg to make callable statements use the form
select * from func() when running against a 7.3 server instead of select func() to allow for set returning functions to be called.
Modified Files:
jdbc/org/postgresql/errors.properties
jdbc/org/postgresql/core/Encoding.java
jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java')
-rw-r--r-- | src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java index 47d3f9f532..cda5ecb59c 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java @@ -8,7 +8,7 @@ import java.util.Vector; import org.postgresql.largeobject.*; import org.postgresql.util.*; -/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.16 2003/02/04 10:09:32 barry Exp $ +/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.17 2003/02/09 23:14:55 barry Exp $ * This class defines methods of the jdbc1 specification. This class is * extended by org.postgresql.jdbc2.AbstractJdbc2Statement which adds the jdbc2 * methods. The real Statement class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Statement @@ -63,7 +63,7 @@ public abstract class AbstractJdbc1Statement implements org.postgresql.PGStateme //Used by the callablestatement style methods private static final String JDBC_SYNTAX = "{[? =] call <some_function> ([? [,?]*]) }"; - private static final String RESULT_COLUMN = "result"; + private static final String RESULT_ALIAS = "result"; private String originalSql = ""; private boolean isFunction; // functionReturnType contains the user supplied value to check @@ -1957,6 +1957,7 @@ public abstract class AbstractJdbc1Statement implements org.postgresql.PGStateme * {? = call <some_function> (?, [?,..]) } * into the PostgreSQL format which is * select <some_function> (?, [?, ...]) as result + * or select * from <some_function> (?, [?, ...]) as result (7.3) * */ private String modifyJdbcCall(String p_sql) throws SQLException @@ -2000,7 +2001,11 @@ public abstract class AbstractJdbc1Statement implements org.postgresql.PGStateme // sure that the parameter numbers are the same as in the original // sql we add a dummy parameter in this case l_sql = (isFunction ? "?" : "") + l_sql.substring (index + 4); - l_sql = "select " + l_sql + " as " + RESULT_COLUMN + ";"; + if (connection.haveMinimumServerVersion("7.3")) { + l_sql = "select * from " + l_sql + " as " + RESULT_ALIAS + ";"; + } else { + l_sql = "select " + l_sql + " as " + RESULT_ALIAS + ";"; + } return l_sql; } |