From: | "Lars Stenberg" <lars(dot)stenberg(at)psycat(dot)net> |
---|---|
To: | <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | 7.3 compability, select * from myfunc(); |
Date: | 2003-02-02 19:52:05 |
Message-ID: | 002801c2caf4$9485e8b0$0301a8c0@ic3 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hi!
The other day when i tried to call a function that returns a set, and i got some error that bla bla context bla bla error =)
After i checked the sources i found that the driver is calling "select myfunc()"(<7.3) instead of "select * from myfunc()"(<=7.3)
So i wrote myself the following patch, now i wonder why this havent been done earlier?
Patch:"
? pgsql-7.3-jdbc-driver-update.patch
Index: src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java,v
retrieving revision 1.12.2.2
diff -c -r1.12.2.2 AbstractJdbc1Statement.java
*** src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java 2002/11/20 07:54:27 1.12.2.2
--- src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java 2003/01/29 20:43:50
***************
*** 1832,1837 ****
--- 1832,1838 ----
* {? = 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
***************
*** 1876,1882 ****
// 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 + ";";
return l_sql;
}
--- 1877,1887 ----
// sql we add a dummy parameter in this case
l_sql = (isFunction ? "?" : "") + l_sql.substring (index + 4);
! if (connection.haveMinimumServerVersion("7.3")) {
! l_sql = "select * from " + l_sql + " as " + RESULT_COLUMN + ";";
! } else {
! l_sql = "select " + l_sql + " as " + RESULT_COLUMN + ";";
! }
return l_sql;
}
"
Mvh
Lars Stenberg
From | Date | Subject | |
---|---|---|---|
Next Message | Lars Stenberg | 2003-02-02 20:01:20 | Coding style |
Previous Message | Hale Pringle | 2003-02-02 19:00:03 | Re: Project criteria |