pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedBug with callable statement and output parameters
21+ messages / 3 participants
[nested] [flat]
* Bug with callable statement and output parameters
@ 2006-04-20 22:02 Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 21+ messages in thread
From: Luis Londono @ 2006-04-20 22:02 UTC (permalink / raw)
To: pgsql-jdbc
I kept getting the following error when using a callable statement with
multiple output parameters:
org.postgresql.util.PSQLException: A CallableStatement function was executed
and the return was of type java.sql.Types=12 however type
java.sql.Types=4was registered.
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(
AbstractJdbc2Statement.java:387)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(
AbstractJdbc2Statement.java:346)
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(
DelegatingPreparedStatement.java:168)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.ibatis.common.jdbc.logging.PreparedStatementLogProxy.invoke(
PreparedStatementLogProxy.java:62)
at $Proxy8.execute(Unknown Source)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(
SqlExecutor.java:287)
at
com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery
(ProcedureStatement.java:34)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback
(GeneralStatement.java:173)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject
(GeneralStatement.java:104)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(
SqlMapExecutorDelegate.java:561)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(
SqlMapExecutorDelegate.java:536)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(
SqlMapSessionImpl.java:93)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(
SqlMapClientImpl.java:70)
at
org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(
SqlMapClientTemplate.java:224)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(
SqlMapClientTemplate.java:165)
at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(
SqlMapClientTemplate.java:222)
at
sms.app.shared.web.session.dao.ibatis.SessionDataDaoImpl.getDataAndRenew2(
SessionDataDaoImpl.java:133)
at test.sms.app.shared.web.session.TestSessionData.testStoredProc(
TestSessionData.java:155)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(
RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(
RemoteTestRunner.java:196)
after much hair pulling, I am certain there are a couple of bugs with the
jdbc driver. The first bug is relatively clear. Line 375 of
org/postgresql/jdbc2/AbstractJdbc2Statement.java, in the latest
8.1-405source tree reads:
int columnType = rs.getMetaData().getColumnType(1); <<<<<< number one
and I believe it should be:
int columnType = rs.getMetaData().getColumnType(i+1); <<<<< letter i plus
one
There is a second problem with output parameter checking, but it is harder
to explain:
- call a function such as: myfunc(p1 IN varchar, p2 OUT int4, p3 OUT
timestamp)
- The registerOutParameter is called as:
cs.registerOutParameter(2, Types.INTEGER)
- this will eventually call the registerOutParameter method in
AbstractJdbc2Statement.java
- this will store in functionReturnType[1] the value of Types.INTEGER
- the call is made to the db and the resultset containing the output
parameters will be retrieved
- in the same place as the previous error, the types are checked,
- The problem arises now. The first output parameter is column 0 of the
result set, but index 1 in the functionReturnType array.
- The types do not match and an error is thrown.
I am not sure what the right fix is for this latter error.
-Luis
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
@ 2006-04-20 23:29 ` Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
0 siblings, 1 reply; 21+ messages in thread
From: Dave Cramer @ 2006-04-20 23:29 UTC (permalink / raw)
To: Luis Londono <somakani@gmail.com>; +Cc: pgsql-jdbc
Luis,
Can you send us a test case that fails. There are a number of test
cases in the driver source code that do pass.
Dave
On 20-Apr-06, at 6:02 PM, Luis Londono wrote:
> I kept getting the following error when using a callable statement
> with multiple output parameters:
>
> org.postgresql.util.PSQLException: A CallableStatement function was
> executed and the return was of type java.sql.Types=12 however type
> java.sql.Types=4 was registered.
> at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags
> (AbstractJdbc2Statement.java:387)
> at org.postgresql.jdbc2.AbstractJdbc2Statement.execute
> (AbstractJdbc2Statement.java :346)
> at org.apache.commons.dbcp.DelegatingPreparedStatement.execute
> (DelegatingPreparedStatement.java:168)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke (Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at
> com.ibatis.common.jdbc.logging.PreparedStatementLogProxy.invoke
> (PreparedStatementLogProxy.java:62)
> at $Proxy8.execute(Unknown Source)
> at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure
> (SqlExecutor.java:287)
> at
> com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecu
> teQuery (ProcedureStatement.java:34)
> at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQue
> ryWithCallback(GeneralStatement.java:173)
> at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQue
> ryForObject (GeneralStatement.java:104)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject
> (SqlMapExecutorDelegate.java:561)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject
> (SqlMapExecutorDelegate.java :536)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject
> (SqlMapSessionImpl.java:93)
> at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject
> (SqlMapClientImpl.java:70)
> at org.springframework.orm.ibatis.SqlMapClientTemplate
> $1.doInSqlMapClient (SqlMapClientTemplate.java:224)
> at org.springframework.orm.ibatis.SqlMapClientTemplate.execute
> (SqlMapClientTemplate.java:165)
> at
> org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject
> (SqlMapClientTemplate.java :222)
> at
> sms.app.shared.web.session.dao.ibatis.SessionDataDaoImpl.getDataAndRen
> ew2(SessionDataDaoImpl.java:133)
> at
> test.sms.app.shared.web.session.TestSessionData.testStoredProc
> (TestSessionData.java:155)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java :106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
> (RemoteTestRunner.java:478)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
> (RemoteTestRunner.java:344)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main
> (RemoteTestRunner.java:196)
>
>
> after much hair pulling, I am certain there are a couple of bugs
> with the jdbc driver. The first bug is relatively clear. Line 375
> of org/postgresql/jdbc2/AbstractJdbc2Statement.java, in the latest
> 8.1-405 source tree reads:
>
> int columnType = rs.getMetaData().getColumnType(1); <<<<<< number one
>
> and I believe it should be:
>
> int columnType = rs.getMetaData().getColumnType(i+1); <<<<<
> letter i plus one
>
> There is a second problem with output parameter checking, but it is
> harder to explain:
> - call a function such as: myfunc(p1 IN varchar, p2 OUT int4, p3
> OUT timestamp)
> - The registerOutParameter is called as:
> cs.registerOutParameter(2, Types.INTEGER)
> - this will eventually call the registerOutParameter method in
> AbstractJdbc2Statement.java
> - this will store in functionReturnType[1] the value of
> Types.INTEGER
> - the call is made to the db and the resultset containing the
> output parameters will be retrieved
> - in the same place as the previous error, the types are checked,
> - The problem arises now. The first output parameter is column 0
> of the result set, but index 1 in the functionReturnType array.
> - The types do not match and an error is thrown.
>
> I am not sure what the right fix is for this latter error.
>
> -Luis
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
@ 2006-04-21 00:03 ` Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 21+ messages in thread
From: Luis Londono @ 2006-04-21 00:03 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: pgsql-jdbc
I am attaching a java file that goes against the following functions:
CREATE OR REPLACE FUNCTION test_somein_someout(
pa IN int4,
pb OUT varchar,
pc OUT int8)
AS
$BODY$
begin
pb := 'pb out';
pc := pa + 1;
end;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
CREATE OR REPLACE FUNCTION test_allinout(
pa INOUT int4,
pb INOUT varchar,
pc INOUT int8)
AS
$BODY$
begin
pa := pa + 1;
pb := 'pb out';
pc := pa + 1;
end;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
I used postgresql-8.1-405.jdbc3.jar against 8.1.0 version of the db. Here
are the results:
org.postgresql.util.PSQLException: A CallableStatement function was executed
and the return was of type java.sql.Types=12 however type
java.sql.Types=0was registered.
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(
AbstractJdbc2Statement.java:387)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(
AbstractJdbc2Statement.java:257)
at TestDriver.testSomeInSomeOut(TestDriver.java:20)
at TestDriver.main(TestDriver.java:54)
org.postgresql.util.PSQLException: A CallableStatement function was executed
and the return was of type java.sql.Types=4 however type
java.sql.Types=12was registered.
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(
AbstractJdbc2Statement.java:387)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(
AbstractJdbc2Statement.java:257)
at TestDriver.testAllInOut(TestDriver.java:40)
at TestDriver.main(TestDriver.java:60)
On 4/20/06, Dave Cramer <pg@fastcrypt.com> wrote:
>
> Luis,
>
> Can you send us a test case that fails. There are a number of test
> cases in the driver source code that do pass.
>
> Dave
> On 20-Apr-06, at 6:02 PM, Luis Londono wrote:
>
> > I kept getting the following error when using a callable statement
> > with multiple output parameters:
> >
> > org.postgresql.util.PSQLException: A CallableStatement function was
> > executed and the return was of type java.sql.Types=12 however type
> > java.sql.Types=4 was registered.
> > at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags
> > (AbstractJdbc2Statement.java:387)
> > at org.postgresql.jdbc2.AbstractJdbc2Statement.execute
> > (AbstractJdbc2Statement.java :346)
> > at org.apache.commons.dbcp.DelegatingPreparedStatement.execute
> > (DelegatingPreparedStatement.java:168)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at sun.reflect.NativeMethodAccessorImpl.invoke (Unknown Source)
> > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> > at java.lang.reflect.Method.invoke(Unknown Source)
> > at
> > com.ibatis.common.jdbc.logging.PreparedStatementLogProxy.invoke
> > (PreparedStatementLogProxy.java:62)
> > at $Proxy8.execute(Unknown Source)
> > at
> > com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure
> > (SqlExecutor.java:287)
> > at
> > com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecu
> > teQuery (ProcedureStatement.java:34)
> > at
> > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQue
> > ryWithCallback(GeneralStatement.java:173)
> > at
> > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQue
> > ryForObject (GeneralStatement.java:104)
> > at
> > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject
> > (SqlMapExecutorDelegate.java:561)
> > at
> > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject
> > (SqlMapExecutorDelegate.java :536)
> > at
> > com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject
> > (SqlMapSessionImpl.java:93)
> > at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject
> > (SqlMapClientImpl.java:70)
> > at org.springframework.orm.ibatis.SqlMapClientTemplate
> > $1.doInSqlMapClient (SqlMapClientTemplate.java:224)
> > at org.springframework.orm.ibatis.SqlMapClientTemplate.execute
> > (SqlMapClientTemplate.java:165)
> > at
> > org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject
> > (SqlMapClientTemplate.java :222)
> > at
> > sms.app.shared.web.session.dao.ibatis.SessionDataDaoImpl.getDataAndRen
> > ew2(SessionDataDaoImpl.java:133)
> > at
> > test.sms.app.shared.web.session.TestSessionData.testStoredProc
> > (TestSessionData.java:155)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> > at java.lang.reflect.Method.invoke(Unknown Source)
> > at junit.framework.TestCase.runTest(TestCase.java:154)
> > at junit.framework.TestCase.runBare(TestCase.java:127)
> > at junit.framework.TestResult$1.protect(TestResult.java :106)
> > at junit.framework.TestResult.runProtected(TestResult.java:124)
> > at junit.framework.TestResult.run(TestResult.java:109)
> > at junit.framework.TestCase.run(TestCase.java:118)
> > at
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
> > (RemoteTestRunner.java:478)
> > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
> > (RemoteTestRunner.java:344)
> > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main
> > (RemoteTestRunner.java:196)
> >
> >
> > after much hair pulling, I am certain there are a couple of bugs
> > with the jdbc driver. The first bug is relatively clear. Line 375
> > of org/postgresql/jdbc2/AbstractJdbc2Statement.java, in the latest
> > 8.1-405 source tree reads:
> >
> > int columnType = rs.getMetaData().getColumnType(1); <<<<<< number one
> >
> > and I believe it should be:
> >
> > int columnType = rs.getMetaData().getColumnType(i+1); <<<<<
> > letter i plus one
> >
> > There is a second problem with output parameter checking, but it is
> > harder to explain:
> > - call a function such as: myfunc(p1 IN varchar, p2 OUT int4, p3
> > OUT timestamp)
> > - The registerOutParameter is called as:
> > cs.registerOutParameter(2, Types.INTEGER)
> > - this will eventually call the registerOutParameter method in
> > AbstractJdbc2Statement.java
> > - this will store in functionReturnType[1] the value of
> > Types.INTEGER
> > - the call is made to the db and the resultset containing the
> > output parameters will be retrieved
> > - in the same place as the previous error, the types are checked,
> > - The problem arises now. The first output parameter is column 0
> > of the result set, but index 1 in the functionReturnType array.
> > - The types do not match and an error is thrown.
> >
> > I am not sure what the right fix is for this latter error.
> >
> > -Luis
>
>
Attachments:
TestDriver.java (application/octet-stream, 1.7K) download
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
@ 2006-04-21 11:27 ` Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 21+ messages in thread
From: Dave Cramer @ 2006-04-21 11:27 UTC (permalink / raw)
To: Luis Londono <somakani@gmail.com>; +Cc: pgsql-jdbc
Luis,
Thanks for the bug report and debugging. I've added your test to the
test cases and I am working out a fix for the second problem
Dave
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
@ 2006-04-26 20:51 ` Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 21+ messages in thread
From: Kris Jurka @ 2006-04-26 20:51 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: Luis Londono <somakani@gmail.com>; pgsql-jdbc
On Fri, 21 Apr 2006, Dave Cramer wrote:
> Thanks for the bug report and debugging. I've added your test to the test
> cases and I am working out a fix for the second problem
>
What's the status of this? I'd like to put out a new release this week
and this would be good to have in it.
Kris Jurka
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
@ 2006-04-26 23:37 ` Kris Jurka <books@ejurka.com>
2006-04-27 16:01 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 21+ messages in thread
From: Kris Jurka @ 2006-04-26 23:37 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: pgsql-jdbc; Luis Londono <somakani@gmail.com>
On Wed, 26 Apr 2006, Dave Cramer wrote:
> I'll try to fix it tonight.
No rush, I've got some other things I'm still looking at.
> If you have any ideas on how to resolve this I'm all ears.
>
1) Require that the number of columns returned is equal to the number of
parameters that the user has called registerOutParameter for.
2) Iterate over the number of parameters ignoring those that haven't been
registered as out paramaters when comparing with the ResultSet.
This will require adding an extra boolean hasBeenRegistered[] array or
inventing an int value that doesn't overlap with any java.sql.Types value
so you can tell what has/has not been registered.
Also I don't know if it is a problem to require a user to register an out
parameter he has no intention of calling a getXXX method on, but that
seems like the only workable solution short of trying to poke into the
system catalogs to find the called function.
Kris Jurka
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
@ 2006-04-27 16:01 ` Dave Cramer <pg@fastcrypt.com>
2006-04-28 02:15 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 21+ messages in thread
From: Dave Cramer @ 2006-04-27 16:01 UTC (permalink / raw)
To: pgsql-jdbc; +Cc: Luis Londono <somakani@gmail.com>; Kris Jurka <books@ejurka.com>
Patch attached for review and test
Index: org/postgresql/jdbc2/AbstractJdbc2Statement.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/jdbc2/
AbstractJdbc2Statement.java,v
retrieving revision 1.88
diff -c -r1.88 AbstractJdbc2Statement.java
*** org/postgresql/jdbc2/AbstractJdbc2Statement.java 1 Feb 2006
18:52:13 -0000 1.88
--- org/postgresql/jdbc2/AbstractJdbc2Statement.java 27 Apr 2006
16:00:50 -0000
***************
*** 366,392 ****
// figure out how many columns
int cols = rs.getMetaData().getColumnCount();
! callResult = new Object[cols];
// move them into the result set
! for ( int i=0; i < cols; i++)
{
! callResult[i] = rs.getObject(i+1);
! int columnType = rs.getMetaData().getColumnType(1);
! if (columnType != functionReturnType[i])
{
// this is here for the sole purpose of
passing the cts
! if ( columnType == Types.DOUBLE &&
functionReturnType[i] == Types.REAL )
{
// return it as a float
! if ( callResult[i] != null)
! callResult[i] = new Float(((Double)
callResult[i]).floatValue());
}
else
{
! throw new PSQLException (GT.tr("A
CallableStatement function was executed and the return was of type
{0} however type {1} was registered.",
! new Object[]{
! "java.sql.Types=" +
columnType, "java.sql.Types=" + functionReturnType[i] }),
PSQLState.DATA_TYPE_MISMATCH);
}
}
--- 366,401 ----
// figure out how many columns
int cols = rs.getMetaData().getColumnCount();
!
! // allocate enough space for all possible parameters
without regard to in/out
! callResult = new Object
[preparedParameters.getParameterCount()+1];
// move them into the result set
! for ( int i=0,j=0; i < cols; i++,j++)
{
! // find the next out parameter, the assumption is
that the functionReturnType
! // array will be initialized with 0 and only out
parameters will have values
! // other than 0. 0 is the value for
java.sql.Types.NULL, which should not
! // conflict
! while( j< functionReturnType.length &&
functionReturnType[j]==0) j++;
!
! callResult[j] = rs.getObject(i+1);
! int columnType = rs.getMetaData().getColumnType(i+1);
!
! if (columnType != functionReturnType[j])
{
// this is here for the sole purpose of
passing the cts
! if ( columnType == Types.DOUBLE &&
functionReturnType[j] == Types.REAL )
{
// return it as a float
! if ( callResult[j] != null)
! callResult[j] = new Float(((Double)
callResult[j]).floatValue());
}
else
{
! throw new PSQLException (GT.tr("A
CallableStatement function was executed and the out parameter {0} was
of type {1} however type {2} was registered.",
! new Object[]{""+i+1,
! "java.sql.Types=" +
columnType, "java.sql.Types=" + functionReturnType[j] }),
PSQLState.DATA_TYPE_MISMATCH);
}
}
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-27 16:01 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
@ 2006-04-28 02:15 ` Kris Jurka <books@ejurka.com>
2006-04-28 12:00 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-01 22:47 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
0 siblings, 2 replies; 21+ messages in thread
From: Kris Jurka @ 2006-04-28 02:15 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: pgsql-jdbc; Luis Londono <somakani@gmail.com>
On Thu, 27 Apr 2006, Dave Cramer wrote:
> Patch attached for review and test
>
This patch does not handle the situation where the number of registered
parameters does not match the number of returned parameters as the
attached tests show.
Also the regression tests you sent me separately are no good. They do not
pass because they mix creating and destroying the test function in the
test method and the tearDown method. This should go into setUp and
tearDown. Also you can't call executeQuery on a CallableStatement because
it will complain with "No results were returned by the query."
The whole Jdbc3CallableStatementTest sucks. It should have all of its
function/table creation destruction moved into setUp/tearDown. Also the
coding:
try {
// something
} catch(Exception e) {
fail(e.getMessage();
}
Is a waste of code. Not only does it not do anything, but it also
obscures the source of the exception.
Kris Jurka
Attachments:
OutFunc.java (text/plain, 1.5K) download
import java.sql.*;
public class OutFunc {
public static void main(String args[]) throws Exception {
Class.forName("org.postgresql.Driver");
Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5820/jurka","jurka","");
try {
testNotEnoughRegisters(conn);
} catch (Exception e) {
e.printStackTrace();
}
try {
testTooManyRegisters(conn);
} catch (Exception e) {
e.printStackTrace();
}
}
private static void testNotEnoughRegisters(Connection conn) throws SQLException {
Statement stmt = conn.createStatement();
stmt.execute("CREATE OR REPLACE FUNCTION myiofunc(a INOUT int, b OUT int) AS 'BEGIN b := a; a := 1; END;' LANGUAGE plpgsql");
CallableStatement cs = conn.prepareCall("{call myiofunc(?,?)}");
cs.setInt(1,2);
cs.registerOutParameter(2,Types.INTEGER);
cs.execute();
System.out.println(cs.getInt(1));
System.out.println(cs.getInt(2));
}
private static void testTooManyRegisters(Connection conn) throws SQLException {
Statement stmt = conn.createStatement();
stmt.execute("CREATE OR REPLACE FUNCTION myif(a INOUT int, b IN int) AS 'BEGIN a := b; END;' LANGUAGE plpgsql");
CallableStatement cs = conn.prepareCall("{call myif(?,?)}");
cs.setInt(1,1);
cs.setInt(2,2);
cs.registerOutParameter(1,Types.INTEGER);
cs.registerOutParameter(2,Types.INTEGER);
cs.execute();
System.out.println(cs.getInt(1));
System.out.println(cs.getInt(2));
}
}
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-27 16:01 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-28 02:15 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
@ 2006-04-28 12:00 ` Dave Cramer <pg@fastcrypt.com>
1 sibling, 0 replies; 21+ messages in thread
From: Dave Cramer @ 2006-04-28 12:00 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc; Luis Londono <somakani@gmail.com>
On 27-Apr-06, at 10:15 PM, Kris Jurka wrote:
>
>
> On Thu, 27 Apr 2006, Dave Cramer wrote:
>
>> Patch attached for review and test
>>
>
> This patch does not handle the situation where the number of
> registered parameters does not match the number of returned
> parameters as the attached tests show.
Thanks, I'll add this test.
>
> Also the regression tests you sent me separately are no good. They
> do not pass because they mix creating and destroying the test
> function in the test method and the tearDown method. This should
> go into setUp and tearDown. Also you can't call executeQuery on a
> CallableStatement because it will complain with "No results were
> returned by the query."
Sorry, I originally had them there but setUp and tearDown get called
for every test, so I moved them, and didn't remove them in teardown.
>
> The whole Jdbc3CallableStatementTest sucks. It should have all of
> its function/table creation destruction moved into setUp/tearDown.
> Also the coding:
So we're OK with adding, and removing the functions for every test ?
>
> try {
> // something
> } catch(Exception e) {
> fail(e.getMessage();
> }
>
> Is a waste of code. Not only does it not do anything, but it also
> obscures the source of the exception.
>
> Kris Jurka
> <OutFunc.java>
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-27 16:01 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-28 02:15 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
@ 2006-05-01 22:47 ` Dave Cramer <pg@fastcrypt.com>
2006-05-04 05:02 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
1 sibling, 1 reply; 21+ messages in thread
From: Dave Cramer @ 2006-05-01 22:47 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc
New patch.
On 27-Apr-06, at 10:15 PM, Kris Jurka wrote:
>
>
> On Thu, 27 Apr 2006, Dave Cramer wrote:
>
>> Patch attached for review and test
>>
>
> This patch does not handle the situation where the number of
> registered parameters does not match the number of returned
> parameters as the attached tests show.
>
> Also the regression tests you sent me separately are no good. They
> do not pass because they mix creating and destroying the test
> function in the test method and the tearDown method. This should
> go into setUp and tearDown. Also you can't call executeQuery on a
> CallableStatement because it will complain with "No results were
> returned by the query."
>
> The whole Jdbc3CallableStatementTest sucks. It should have all of
> its function/table creation destruction moved into setUp/tearDown.
> Also the coding:
>
> try {
> // something
> } catch(Exception e) {
> fail(e.getMessage();
> }
>
> Is a waste of code. Not only does it not do anything, but it also
> obscures the source of the exception.
>
> Kris Jurka
> <OutFunc.java>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
Attachments:
xxx.diff (application/octet-stream, 12.9K) download
Index: org/postgresql/jdbc2/AbstractJdbc2Statement.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java,v
retrieving revision 1.88
diff -c -r1.88 AbstractJdbc2Statement.java
*** org/postgresql/jdbc2/AbstractJdbc2Statement.java 1 Feb 2006 18:52:13 -0000 1.88
--- org/postgresql/jdbc2/AbstractJdbc2Statement.java 1 May 2006 22:46:14 -0000
***************
*** 366,392 ****
// figure out how many columns
int cols = rs.getMetaData().getColumnCount();
! callResult = new Object[cols];
// move them into the result set
! for ( int i=0; i < cols; i++)
{
! callResult[i] = rs.getObject(i+1);
! int columnType = rs.getMetaData().getColumnType(1);
! if (columnType != functionReturnType[i])
{
// this is here for the sole purpose of passing the cts
! if ( columnType == Types.DOUBLE && functionReturnType[i] == Types.REAL )
{
// return it as a float
! if ( callResult[i] != null)
! callResult[i] = new Float(((Double)callResult[i]).floatValue());
}
else
{
! throw new PSQLException (GT.tr("A CallableStatement function was executed and the return was of type {0} however type {1} was registered.",
! new Object[]{
! "java.sql.Types=" + columnType, "java.sql.Types=" + functionReturnType[i] }),
PSQLState.DATA_TYPE_MISMATCH);
}
}
--- 366,403 ----
// figure out how many columns
int cols = rs.getMetaData().getColumnCount();
!
! // allocate enough space for all possible parameters without regard to in/out
! callResult = new Object[preparedParameters.getParameterCount()+1];
// move them into the result set
! for ( int i=0,j=0; i < cols; i++,j++)
{
! // find the next out parameter, the assumption is that the functionReturnType
! // array will be initialized with 0 and only out parameters will have values
! // other than 0. 0 is the value for java.sql.Types.NULL, which should not
! // conflict
! while( j< functionReturnType.length && functionReturnType[j]==0) j++;
!
! if ( j >= callResult.length )
! throw new PSQLException(GT.tr("A CallableStatement was excecuted with and invalid number of parameters"),PSQLState.SYNTAX_ERROR);
! callResult[j] = rs.getObject(i+1);
! int columnType = rs.getMetaData().getColumnType(i+1);
!
! if (columnType != functionReturnType[j])
{
// this is here for the sole purpose of passing the cts
! if ( columnType == Types.DOUBLE && functionReturnType[j] == Types.REAL )
{
// return it as a float
! if ( callResult[j] != null)
! callResult[j] = new Float(((Double)callResult[j]).floatValue());
}
else
{
! throw new PSQLException (GT.tr("A CallableStatement function was executed and the out parameter {0} was of type {1} however type {2} was registered.",
! new Object[]{""+i+1,
! "java.sql.Types=" + columnType, "java.sql.Types=" + functionReturnType[j] }),
PSQLState.DATA_TYPE_MISMATCH);
}
}
Index: org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java,v
retrieving revision 1.1
diff -c -r1.1 Jdbc3CallableStatementTest.java
*** org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java 4 Jul 2005 19:19:31 -0000 1.1
--- org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java 1 May 2006 22:46:16 -0000
***************
*** 11,20 ****
--- 11,23 ----
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+ import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
+ import org.postgresql.Driver;
import org.postgresql.test.TestUtil;
+ import org.postgresql.util.PSQLState;
import junit.framework.TestCase;
***************
*** 26,31 ****
--- 29,35 ----
*/
public class Jdbc3CallableStatementTest extends TestCase
{
+
Connection con;
/* (non-Javadoc)
***************
*** 48,54 ****
--- 52,85 ----
+ " end;' "
+ "language 'plpgsql';");
+ stmt.execute( "CREATE OR REPLACE FUNCTION test_somein_someout("
+ + "pa IN int4,"
+ + "pb OUT varchar,"
+ + "pc OUT int8)"
+ + " AS "
+
+ + "'begin "
+ + "pb := ''out'';"
+ + "pc := pa + 1;"
+ + "end;'"
+
+ + "LANGUAGE 'plpgsql' VOLATILE;"
+ );
+ stmt.execute("CREATE OR REPLACE FUNCTION test_allinout("
+ + "pa INOUT int4,"
+ + "pb INOUT varchar,"
+ + "pc INOUT int8)"
+ + " AS "
+ + "'begin "
+ + "pa := pa + 1;"
+ + "pb := ''foo out'';"
+ + "pc := pa + 1;"
+ + "end;'"
+ + "LANGUAGE 'plpgsql' VOLATILE;"
+ );
+
+
}
/* (non-Javadoc)
* @see junit.framework.TestCase#tearDown()
***************
*** 57,70 ****
{
Statement stmt = con.createStatement();
stmt.execute("drop function Numeric_Proc(out decimal, out decimal, out decimal)");
stmt.close();
}
! public void testNumeric() throws Throwable
{
try
{
CallableStatement call = con.prepareCall( "{ call Numeric_Proc(?,?,?) }" ) ;
call.registerOutParameter(1,Types.NUMERIC,15);
--- 88,169 ----
{
Statement stmt = con.createStatement();
stmt.execute("drop function Numeric_Proc(out decimal, out decimal, out decimal)");
+ stmt.execute("drop function test_somein_someout(int4)");
+ stmt.execute("drop function test_allinout( inout int4, inout varchar, inout int8)");
+
stmt.close();
}
+ public void testSomeInOut() throws Throwable
+ {
+
+
+ CallableStatement call = con.prepareCall( "{ call test_somein_someout(?,?,?) }" ) ;
+
+ call.registerOutParameter(2,Types.VARCHAR);
+ call.registerOutParameter(3,Types.BIGINT);
+ call.setInt(1,20);
+ call.execute();
! }
! public void testNotEnoughParameters() throws Throwable
! {
! Statement stmt = con.createStatement();
! stmt.execute("CREATE OR REPLACE FUNCTION myiofunc(a INOUT int, b OUT int) AS 'BEGIN b := a; a := 1; END;' LANGUAGE plpgsql");
!
! CallableStatement cs = con.prepareCall("{call myiofunc(?,?)}");
! cs.setInt(1,2);
! cs.registerOutParameter(2,Types.INTEGER);
! try
! {
! cs.execute();
! fail("Should throw an exception ");
! }
! catch( SQLException ex)
! {
! assertTrue(ex.getSQLState().equalsIgnoreCase(PSQLState.SYNTAX_ERROR.getState()));
! }
!
! }
! public void testTooManyParameters() throws Throwable
{
+ Statement stmt = con.createStatement();
+ stmt.execute("CREATE OR REPLACE FUNCTION myiofunc(a INOUT int, b OUT int) AS 'BEGIN b := a; a := 1; END;' LANGUAGE plpgsql");
+
+ CallableStatement cs = con.prepareCall("{call myiofunc(?,?)}");
+ cs.setInt(1,2);
+ cs.registerOutParameter(2,Types.INTEGER);
try
+ {
+ cs.execute();
+ fail("Should throw an exception ");
+ }
+ catch( SQLException ex)
{
+ assertTrue(ex.getSQLState().equalsIgnoreCase(PSQLState.SYNTAX_ERROR.getState()));
+ }
+ }
+ public void testAllInOut() throws Throwable
+ {
+
+ CallableStatement call = con.prepareCall( "{ call test_allinout(?,?,?) }" ) ;
+
+ call.registerOutParameter(1,Types.INTEGER);
+ call.registerOutParameter(2,Types.VARCHAR);
+ call.registerOutParameter(3,Types.BIGINT);
+ call.setInt(1,20);
+ call.setString(2,"hi");
+ call.setInt(3,123);
+ call.execute();
+ call.getInt(1);
+ call.getString(2);
+ call.getLong(3);
+
+ }
+
+ public void testNumeric() throws Throwable
+ {
+
CallableStatement call = con.prepareCall( "{ call Numeric_Proc(?,?,?) }" ) ;
call.registerOutParameter(1,Types.NUMERIC,15);
***************
*** 78,84 ****
ret=call.getBigDecimal(2);
assertTrue ("correct return from getNumeric ()",
! ret.equals (new java.math.BigDecimal("0.000000000000001")));
try
{
ret = call.getBigDecimal(3);
--- 177,183 ----
ret=call.getBigDecimal(2);
assertTrue ("correct return from getNumeric ()",
! ret.equals (new java.math.BigDecimal("0.000000000000001")));
try
{
ret = call.getBigDecimal(3);
***************
*** 87,120 ****
assertTrue("This should be null",call.wasNull());
}
! }
! catch(Exception ex)
! {
! fail(ex.getMessage());
! }
}
public void testGetObjectDecimal() throws Throwable
{
try
{
! Statement stmt = con.createStatement();
! stmt.execute("create temp table decimal_tab ( max_val numeric(30,15), min_val numeric(30,15), nul_val numeric(30,15) )");
! stmt.execute("insert into decimal_tab values (999999999999999.000000000000000,0.000000000000001,null)");
! boolean ret = stmt.execute("create or replace function "
! + "decimal_proc( OUT pmax numeric, OUT pmin numeric, OUT nval numeric) as "
! + "'begin "
! + "select max_val into pmax from decimal_tab;"
! + "select min_val into pmin from decimal_tab;"
! + "select nul_val into nval from decimal_tab;"
!
! + " end;' "
! + "language 'plpgsql';");
}
catch (Exception ex)
{
fail ( ex.getMessage());
throw ex;
}
try
{
CallableStatement cstmt = con.prepareCall("{ call decimal_proc(?,?,?) }");
--- 186,218 ----
assertTrue("This should be null",call.wasNull());
}
!
!
}
public void testGetObjectDecimal() throws Throwable
{
try
{
! Statement stmt = con.createStatement();
! stmt.execute("create temp table decimal_tab ( max_val numeric(30,15), min_val numeric(30,15), nul_val numeric(30,15) )");
! stmt.execute("insert into decimal_tab values (999999999999999.000000000000000,0.000000000000001,null)");
!
! boolean ret = stmt.execute("create or replace function "
! + "decimal_proc( OUT pmax numeric, OUT pmin numeric, OUT nval numeric) as "
! + "'begin "
! + "select max_val into pmax from decimal_tab;"
! + "select min_val into pmin from decimal_tab;"
! + "select nul_val into nval from decimal_tab;"
!
! + " end;' "
! + "language 'plpgsql';");
}
catch (Exception ex)
{
fail ( ex.getMessage());
throw ex;
}
+
try
{
CallableStatement cstmt = con.prepareCall("{ call decimal_proc(?,?,?) }");
***************
*** 234,243 ****
cstmt.getBoolean(3);
assertTrue(cstmt.wasNull());
}
! catch ( Exception ex )
! {
! fail(ex.getMessage());
! }
finally
{
try
--- 332,338 ----
cstmt.getBoolean(3);
assertTrue(cstmt.wasNull());
}
!
finally
{
try
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-27 16:01 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-28 02:15 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-01 22:47 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
@ 2006-05-04 05:02 ` Kris Jurka <books@ejurka.com>
2006-05-04 15:08 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 21+ messages in thread
From: Kris Jurka @ 2006-05-04 05:02 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: pgsql-jdbc
On Mon, 1 May 2006, Dave Cramer wrote:
> New patch.
>
You've made a mistake integrating the additional tests that I sent you.
You're using the same function for both tests when I used two different
function signatures. If you use the correct function definitions you can
see that one of them is still failing. Also the tests are leaving the
created function around in the test database. If you remove the "OR
REPLACE" you can see this.
Finally there's a typo in the error message about an invalid number of
parameters. It should say "an invalid" instead of "and invalid".
Kris Jurka
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-27 16:01 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-28 02:15 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-01 22:47 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-04 05:02 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
@ 2006-05-04 15:08 ` Dave Cramer <pg@fastcrypt.com>
2006-05-11 00:52 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 21+ messages in thread
From: Dave Cramer @ 2006-05-04 15:08 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc
Kris,
Ok, this should be it....
On 4-May-06, at 1:02 AM, Kris Jurka wrote:
>
>
> On Mon, 1 May 2006, Dave Cramer wrote:
>
>> New patch.
>>
>
> You've made a mistake integrating the additional tests that I sent
> you. You're using the same function for both tests when I used two
> different function signatures. If you use the correct function
> definitions you can see that one of them is still failing. Also
> the tests are leaving the created function around in the test
> database. If you remove the "OR REPLACE" you can see this.
>
> Finally there's a typo in the error message about an invalid number
> of parameters. It should say "an invalid" instead of "and invalid".
>
> Kris Jurka
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: explain analyze is your friend
>
Attachments:
xxx.diff (application/octet-stream, 20.0K) download
Index: org/postgresql/jdbc2/AbstractJdbc2Statement.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java,v
retrieving revision 1.88
diff -c -r1.88 AbstractJdbc2Statement.java
*** org/postgresql/jdbc2/AbstractJdbc2Statement.java 1 Feb 2006 18:52:13 -0000 1.88
--- org/postgresql/jdbc2/AbstractJdbc2Statement.java 4 May 2006 15:05:56 -0000
***************
*** 138,145 ****
this.preparedQuery = connection.getQueryExecutor().createParameterizedQuery(parsed_sql);
this.preparedParameters = preparedQuery.createParameterList();
! this.testReturn = new int[preparedParameters.getInParameterCount()+1];
! this.functionReturnType = new int[preparedParameters.getInParameterCount()+1];
resultsettype = rsType;
--- 138,146 ----
this.preparedQuery = connection.getQueryExecutor().createParameterizedQuery(parsed_sql);
this.preparedParameters = preparedQuery.createParameterList();
! int inParamCount = preparedParameters.getInParameterCount() + 1;
! this.testReturn = new int[inParamCount];
! this.functionReturnType = new int[inParamCount];
resultsettype = rsType;
***************
*** 366,392 ****
// figure out how many columns
int cols = rs.getMetaData().getColumnCount();
! callResult = new Object[cols];
// move them into the result set
! for ( int i=0; i < cols; i++)
{
! callResult[i] = rs.getObject(i+1);
! int columnType = rs.getMetaData().getColumnType(1);
! if (columnType != functionReturnType[i])
{
// this is here for the sole purpose of passing the cts
! if ( columnType == Types.DOUBLE && functionReturnType[i] == Types.REAL )
{
// return it as a float
! if ( callResult[i] != null)
! callResult[i] = new Float(((Double)callResult[i]).floatValue());
}
else
{
! throw new PSQLException (GT.tr("A CallableStatement function was executed and the return was of type {0} however type {1} was registered.",
! new Object[]{
! "java.sql.Types=" + columnType, "java.sql.Types=" + functionReturnType[i] }),
PSQLState.DATA_TYPE_MISMATCH);
}
}
--- 367,407 ----
// figure out how many columns
int cols = rs.getMetaData().getColumnCount();
!
! int outParameterCount = preparedParameters.getOutParameterCount() ;
!
! if ( cols != outParameterCount )
! throw new PSQLException(GT.tr("A CallableStatement was excecuted with an invalid number of parameters"),PSQLState.SYNTAX_ERROR);
!
! // allocate enough space for all possible parameters without regard to in/out
! callResult = new Object[preparedParameters.getParameterCount()+1];
// move them into the result set
! for ( int i=0,j=0; i < cols; i++,j++)
{
! // find the next out parameter, the assumption is that the functionReturnType
! // array will be initialized with 0 and only out parameters will have values
! // other than 0. 0 is the value for java.sql.Types.NULL, which should not
! // conflict
! while( j< functionReturnType.length && functionReturnType[j]==0) j++;
!
! callResult[j] = rs.getObject(i+1);
! int columnType = rs.getMetaData().getColumnType(i+1);
!
! if (columnType != functionReturnType[j])
{
// this is here for the sole purpose of passing the cts
! if ( columnType == Types.DOUBLE && functionReturnType[j] == Types.REAL )
{
// return it as a float
! if ( callResult[j] != null)
! callResult[j] = new Float(((Double)callResult[j]).floatValue());
}
else
{
! throw new PSQLException (GT.tr("A CallableStatement function was executed and the out parameter {0} was of type {1} however type {2} was registered.",
! new Object[]{""+i+1,
! "java.sql.Types=" + columnType, "java.sql.Types=" + functionReturnType[j] }),
PSQLState.DATA_TYPE_MISMATCH);
}
}
Index: org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java,v
retrieving revision 1.1
diff -c -r1.1 Jdbc3CallableStatementTest.java
*** org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java 4 Jul 2005 19:19:31 -0000 1.1
--- org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java 4 May 2006 15:05:58 -0000
***************
*** 11,20 ****
--- 11,23 ----
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+ import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
+ import org.postgresql.Driver;
import org.postgresql.test.TestUtil;
+ import org.postgresql.util.PSQLState;
import junit.framework.TestCase;
***************
*** 26,31 ****
--- 29,35 ----
*/
public class Jdbc3CallableStatementTest extends TestCase
{
+
Connection con;
/* (non-Javadoc)
***************
*** 37,44 ****
Statement stmt = con.createStatement ();
stmt.execute("create temp table numeric_tab (MAX_VAL NUMERIC(30,15), MIN_VAL NUMERIC(30,15), NULL_VAL NUMERIC(30,15) NULL)");
stmt.execute("insert into numeric_tab values ( 999999999999999,0.000000000000001, null)");
! boolean ret = stmt.execute("create or replace function "
+ "Numeric_Proc( OUT IMAX NUMERIC(30,15), OUT IMIN NUMERIC(30,15), OUT INUL NUMERIC(30,15)) as "
+ "'begin "
+ "select max_val into imax from numeric_tab;"
--- 41,50 ----
Statement stmt = con.createStatement ();
stmt.execute("create temp table numeric_tab (MAX_VAL NUMERIC(30,15), MIN_VAL NUMERIC(30,15), NULL_VAL NUMERIC(30,15) NULL)");
stmt.execute("insert into numeric_tab values ( 999999999999999,0.000000000000001, null)");
+ stmt.execute("CREATE OR REPLACE FUNCTION myiofunc(a INOUT int, b OUT int) AS 'BEGIN b := a; a := 1; END;' LANGUAGE plpgsql");
+ stmt.execute("CREATE OR REPLACE FUNCTION myif(a INOUT int, b IN int) AS 'BEGIN a := b; END;' LANGUAGE plpgsql");
! stmt.execute("create or replace function "
+ "Numeric_Proc( OUT IMAX NUMERIC(30,15), OUT IMIN NUMERIC(30,15), OUT INUL NUMERIC(30,15)) as "
+ "'begin "
+ "select max_val into imax from numeric_tab;"
***************
*** 48,54 ****
--- 54,87 ----
+ " end;' "
+ "language 'plpgsql';");
+ stmt.execute( "CREATE OR REPLACE FUNCTION test_somein_someout("
+ + "pa IN int4,"
+ + "pb OUT varchar,"
+ + "pc OUT int8)"
+ + " AS "
+
+ + "'begin "
+ + "pb := ''out'';"
+ + "pc := pa + 1;"
+ + "end;'"
+ + "LANGUAGE 'plpgsql' VOLATILE;"
+
+ );
+ stmt.execute("CREATE OR REPLACE FUNCTION test_allinout("
+ + "pa INOUT int4,"
+ + "pb INOUT varchar,"
+ + "pc INOUT int8)"
+ + " AS "
+ + "'begin "
+ + "pa := pa + 1;"
+ + "pb := ''foo out'';"
+ + "pc := pa + 1;"
+ + "end;'"
+ + "LANGUAGE 'plpgsql' VOLATILE;"
+ );
+
+
}
/* (non-Javadoc)
* @see junit.framework.TestCase#tearDown()
***************
*** 57,70 ****
{
Statement stmt = con.createStatement();
stmt.execute("drop function Numeric_Proc(out decimal, out decimal, out decimal)");
stmt.close();
}
! public void testNumeric() throws Throwable
{
try
{
CallableStatement call = con.prepareCall( "{ call Numeric_Proc(?,?,?) }" ) ;
call.registerOutParameter(1,Types.NUMERIC,15);
--- 90,171 ----
{
Statement stmt = con.createStatement();
stmt.execute("drop function Numeric_Proc(out decimal, out decimal, out decimal)");
+ stmt.execute("drop function test_somein_someout(int4)");
+ stmt.execute("drop function test_allinout( inout int4, inout varchar, inout int8)");
+ stmt.execute("drop function myiofunc(a INOUT int, b OUT int) ");
+ stmt.execute("drop function myif(a INOUT int, b IN int)");
stmt.close();
}
+ public void testSomeInOut() throws Throwable
+ {
+
+
+ CallableStatement call = con.prepareCall( "{ call test_somein_someout(?,?,?) }" ) ;
+
+ call.registerOutParameter(2,Types.VARCHAR);
+ call.registerOutParameter(3,Types.BIGINT);
+ call.setInt(1,20);
+ call.execute();
! }
! public void testNotEnoughParameters() throws Throwable
! {
!
! CallableStatement cs = con.prepareCall("{call myiofunc(?,?)}");
! cs.setInt(1,2);
! cs.registerOutParameter(2,Types.INTEGER);
! try
! {
! cs.execute();
! fail("Should throw an exception ");
! }
! catch( SQLException ex)
! {
! assertTrue(ex.getSQLState().equalsIgnoreCase(PSQLState.SYNTAX_ERROR.getState()));
! }
!
! }
! public void testTooManyParameters() throws Throwable
{
+
+ CallableStatement cs = con.prepareCall("{call myif(?,?)}");
try
{
+ cs.setInt(1,1);
+ cs.setInt(2,2);
+ cs.registerOutParameter(1,Types.INTEGER);
+ cs.registerOutParameter(2,Types.INTEGER);
+ cs.execute();
+ fail("should throw an exception");
+ }
+ catch( SQLException ex )
+ {
+ assertTrue(ex.getSQLState().equalsIgnoreCase(PSQLState.SYNTAX_ERROR.getState()));
+ }
+
+ }
+ public void testAllInOut() throws Throwable
+ {
+
+ CallableStatement call = con.prepareCall( "{ call test_allinout(?,?,?) }" ) ;
+
+ call.registerOutParameter(1,Types.INTEGER);
+ call.registerOutParameter(2,Types.VARCHAR);
+ call.registerOutParameter(3,Types.BIGINT);
+ call.setInt(1,20);
+ call.setString(2,"hi");
+ call.setInt(3,123);
+ call.execute();
+ call.getInt(1);
+ call.getString(2);
+ call.getLong(3);
+
+ }
+
+ public void testNumeric() throws Throwable
+ {
+
CallableStatement call = con.prepareCall( "{ call Numeric_Proc(?,?,?) }" ) ;
call.registerOutParameter(1,Types.NUMERIC,15);
***************
*** 78,84 ****
ret=call.getBigDecimal(2);
assertTrue ("correct return from getNumeric ()",
! ret.equals (new java.math.BigDecimal("0.000000000000001")));
try
{
ret = call.getBigDecimal(3);
--- 179,185 ----
ret=call.getBigDecimal(2);
assertTrue ("correct return from getNumeric ()",
! ret.equals (new java.math.BigDecimal("0.000000000000001")));
try
{
ret = call.getBigDecimal(3);
***************
*** 87,120 ****
assertTrue("This should be null",call.wasNull());
}
! }
! catch(Exception ex)
! {
! fail(ex.getMessage());
! }
}
public void testGetObjectDecimal() throws Throwable
{
try
{
! Statement stmt = con.createStatement();
! stmt.execute("create temp table decimal_tab ( max_val numeric(30,15), min_val numeric(30,15), nul_val numeric(30,15) )");
! stmt.execute("insert into decimal_tab values (999999999999999.000000000000000,0.000000000000001,null)");
! boolean ret = stmt.execute("create or replace function "
! + "decimal_proc( OUT pmax numeric, OUT pmin numeric, OUT nval numeric) as "
! + "'begin "
! + "select max_val into pmax from decimal_tab;"
! + "select min_val into pmin from decimal_tab;"
! + "select nul_val into nval from decimal_tab;"
!
! + " end;' "
! + "language 'plpgsql';");
}
catch (Exception ex)
{
fail ( ex.getMessage());
throw ex;
}
try
{
CallableStatement cstmt = con.prepareCall("{ call decimal_proc(?,?,?) }");
--- 188,220 ----
assertTrue("This should be null",call.wasNull());
}
!
!
}
public void testGetObjectDecimal() throws Throwable
{
try
{
! Statement stmt = con.createStatement();
! stmt.execute("create temp table decimal_tab ( max_val numeric(30,15), min_val numeric(30,15), nul_val numeric(30,15) )");
! stmt.execute("insert into decimal_tab values (999999999999999.000000000000000,0.000000000000001,null)");
!
! boolean ret = stmt.execute("create or replace function "
! + "decimal_proc( OUT pmax numeric, OUT pmin numeric, OUT nval numeric) as "
! + "'begin "
! + "select max_val into pmax from decimal_tab;"
! + "select min_val into pmin from decimal_tab;"
! + "select nul_val into nval from decimal_tab;"
!
! + " end;' "
! + "language 'plpgsql';");
}
catch (Exception ex)
{
fail ( ex.getMessage());
throw ex;
}
+
try
{
CallableStatement cstmt = con.prepareCall("{ call decimal_proc(?,?,?) }");
***************
*** 234,243 ****
cstmt.getBoolean(3);
assertTrue(cstmt.wasNull());
}
! catch ( Exception ex )
! {
! fail(ex.getMessage());
! }
finally
{
try
--- 334,340 ----
cstmt.getBoolean(3);
assertTrue(cstmt.wasNull());
}
!
finally
{
try
Index: org/postgresql/core/ParameterList.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/core/ParameterList.java,v
retrieving revision 1.8
diff -c -r1.8 ParameterList.java
*** org/postgresql/core/ParameterList.java 8 Jul 2005 17:38:28 -0000 1.8
--- org/postgresql/core/ParameterList.java 4 May 2006 15:05:58 -0000
***************
*** 40,52 ****
int getParameterCount();
/**
! * Get the number of parameters in this list. This value may be different,
! * and might be zero.
*
! * @return the number of in parameters in this list
*/
int getInParameterCount();
/**
* Return the oids of the parameters in this list. May be null for
--- 40,57 ----
int getParameterCount();
/**
! * Get the number of IN parameters in this list.
*
! * @return the number of IN parameters in this list
*/
int getInParameterCount();
+ /**
+ * Get the number of OUT parameters in this list.
+ *
+ * @return the number of OUT parameters in this list
+ */
+ int getOutParameterCount();
/**
* Return the oids of the parameters in this list. May be null for
Index: org/postgresql/core/v2/FastpathParameterList.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/core/v2/FastpathParameterList.java,v
retrieving revision 1.8
diff -c -r1.8 FastpathParameterList.java
*** org/postgresql/core/v2/FastpathParameterList.java 4 Jul 2005 18:50:28 -0000 1.8
--- org/postgresql/core/v2/FastpathParameterList.java 4 May 2006 15:05:58 -0000
***************
*** 40,45 ****
--- 40,49 ----
public int getInParameterCount() {
return paramValues.length;
}
+ public int getOutParameterCount()
+ {
+ return 0;
+ }
public int getParameterCount()
{
return paramValues.length;
Index: org/postgresql/core/v2/SimpleParameterList.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/core/v2/SimpleParameterList.java,v
retrieving revision 1.7
diff -c -r1.7 SimpleParameterList.java
*** org/postgresql/core/v2/SimpleParameterList.java 4 Jul 2005 18:50:28 -0000 1.7
--- org/postgresql/core/v2/SimpleParameterList.java 4 May 2006 15:05:59 -0000
***************
*** 41,46 ****
--- 41,50 ----
{
return paramValues.length;
}
+ public int getOutParameterCount()
+ {
+ return 0;
+ }
public int[] getTypeOIDs() {
return null;
}
Index: org/postgresql/core/v3/CompositeParameterList.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/core/v3/CompositeParameterList.java,v
retrieving revision 1.8
diff -c -r1.8 CompositeParameterList.java
*** org/postgresql/core/v3/CompositeParameterList.java 4 Jul 2005 18:50:29 -0000 1.8
--- org/postgresql/core/v3/CompositeParameterList.java 4 May 2006 15:05:59 -0000
***************
*** 52,61 ****
{
return total;
}
! public int getInParameterCount() {
return total;
}
!
public int[] getTypeOIDs() {
int oids[] = new int[total];
for (int i=0; i<offsets.length; i++) {
--- 52,65 ----
{
return total;
}
! public int getInParameterCount()
! {
return total;
}
! public int getOutParameterCount()
! {
! return 0;
! }
public int[] getTypeOIDs() {
int oids[] = new int[total];
for (int i=0; i<offsets.length; i++) {
Index: org/postgresql/core/v3/SimpleParameterList.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/core/v3/SimpleParameterList.java,v
retrieving revision 1.11
diff -c -r1.11 SimpleParameterList.java
*** org/postgresql/core/v3/SimpleParameterList.java 24 Nov 2005 06:18:28 -0000 1.11
--- org/postgresql/core/v3/SimpleParameterList.java 4 May 2006 15:06:01 -0000
***************
*** 71,80 ****
{
return paramValues.length;
}
public int getInParameterCount()
{
int count=0;
! for( int i=0; i< paramTypes.length;i++)
{
if (direction[i] != OUT )
{
--- 71,93 ----
{
return paramValues.length;
}
+ public int getOutParameterCount()
+ {
+ int count=0;
+ for( int i=paramTypes.length; --i >= 0;)
+ {
+ if ((direction[i] & OUT) == OUT )
+ {
+ count++;
+ }
+ }
+ return count;
+
+ }
public int getInParameterCount()
{
int count=0;
! for( int i=paramTypes.length; --i >= 0;)
{
if (direction[i] != OUT )
{
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-27 16:01 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-28 02:15 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-01 22:47 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-04 05:02 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-04 15:08 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
@ 2006-05-11 00:52 ` Kris Jurka <books@ejurka.com>
2006-05-11 02:24 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 21+ messages in thread
From: Kris Jurka @ 2006-05-11 00:52 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: pgsql-jdbc
On Thu, 4 May 2006, Dave Cramer wrote:
> Kris,
>
> Ok, this should be it....
This does not work for V2 protocol connections. While we don't support
OUT/INOUT parameters over V2, we do support {? = call func()}.
Kris Jurka
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-27 16:01 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-28 02:15 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-01 22:47 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-04 05:02 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-04 15:08 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-11 00:52 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
@ 2006-05-11 02:24 ` Dave Cramer <pg@fastcrypt.com>
2006-05-11 03:11 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 21+ messages in thread
From: Dave Cramer @ 2006-05-11 02:24 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc
Kris,
Do you remember why we need outParmBeforeFunc. Did changes I made
break this, or has this been broken for a while ?
Dave
On 10-May-06, at 8:52 PM, Kris Jurka wrote:
>
>
> On Thu, 4 May 2006, Dave Cramer wrote:
>
>> Kris,
>>
>> Ok, this should be it....
>
> This does not work for V2 protocol connections. While we don't
> support OUT/INOUT parameters over V2, we do support {? = call func()}.
>
> Kris Jurka
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-27 16:01 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-28 02:15 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-01 22:47 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-04 05:02 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-04 15:08 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-11 00:52 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-11 02:24 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
@ 2006-05-11 03:11 ` Kris Jurka <books@ejurka.com>
2006-05-21 12:00 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 21+ messages in thread
From: Kris Jurka @ 2006-05-11 03:11 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: pgsql-jdbc
On Wed, 10 May 2006, Dave Cramer wrote:
> Do you remember why we need outParmBeforeFunc. Did changes I made break this,
> or has this been broken for a while ?
>
This works fine on CVS HEAD, so it's your patch. To be honest I haven't
really been looking at the changes you've made in callable statements for
a while, just testing them.
Kris Jurka
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-27 16:01 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-28 02:15 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-01 22:47 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-04 05:02 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-04 15:08 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-11 00:52 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-11 02:24 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-11 03:11 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
@ 2006-05-21 12:00 ` Dave Cramer <pg@fastcrypt.com>
2006-05-22 10:05 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 21+ messages in thread
From: Dave Cramer @ 2006-05-21 12:00 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc
Kris,
Attached is a patch that works on 8.1 and 7.3 for sure
On 10-May-06, at 11:11 PM, Kris Jurka wrote:
>
>
> On Wed, 10 May 2006, Dave Cramer wrote:
>
>> Do you remember why we need outParmBeforeFunc. Did changes I made
>> break this, or has this been broken for a while ?
>>
>
> This works fine on CVS HEAD, so it's your patch. To be honest I
> haven't really been looking at the changes you've made in callable
> statements for a while, just testing them.
>
> Kris Jurka
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>
Attachments:
xxx.diff (application/octet-stream, 25.2K) download
Index: org/postgresql/core/ParameterList.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/core/ParameterList.java,v
retrieving revision 1.8
diff -c -r1.8 ParameterList.java
*** org/postgresql/core/ParameterList.java 8 Jul 2005 17:38:28 -0000 1.8
--- org/postgresql/core/ParameterList.java 21 May 2006 11:06:05 -0000
***************
*** 40,52 ****
int getParameterCount();
/**
! * Get the number of parameters in this list. This value may be different,
! * and might be zero.
*
! * @return the number of in parameters in this list
*/
int getInParameterCount();
/**
* Return the oids of the parameters in this list. May be null for
--- 40,57 ----
int getParameterCount();
/**
! * Get the number of IN parameters in this list.
*
! * @return the number of IN parameters in this list
*/
int getInParameterCount();
+ /**
+ * Get the number of OUT parameters in this list.
+ *
+ * @return the number of OUT parameters in this list
+ */
+ int getOutParameterCount();
/**
* Return the oids of the parameters in this list. May be null for
Index: org/postgresql/core/v2/FastpathParameterList.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/core/v2/FastpathParameterList.java,v
retrieving revision 1.8
diff -c -r1.8 FastpathParameterList.java
*** org/postgresql/core/v2/FastpathParameterList.java 4 Jul 2005 18:50:28 -0000 1.8
--- org/postgresql/core/v2/FastpathParameterList.java 21 May 2006 11:06:05 -0000
***************
*** 40,45 ****
--- 40,49 ----
public int getInParameterCount() {
return paramValues.length;
}
+ public int getOutParameterCount()
+ {
+ return 0;
+ }
public int getParameterCount()
{
return paramValues.length;
Index: org/postgresql/core/v2/SimpleParameterList.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/core/v2/SimpleParameterList.java,v
retrieving revision 1.7
diff -c -r1.7 SimpleParameterList.java
*** org/postgresql/core/v2/SimpleParameterList.java 4 Jul 2005 18:50:28 -0000 1.7
--- org/postgresql/core/v2/SimpleParameterList.java 21 May 2006 11:06:06 -0000
***************
*** 27,38 ****
*
* @author Oliver Jowett (oliver@opencloud.com)
*/
! class SimpleParameterList implements ParameterList {
SimpleParameterList(int paramCount) {
this.paramValues = new Object[paramCount];
}
! public void registerOutParameter(int index, int sqlType ){};
! public void registerOutParameter(int index, int sqlType, int precision ){};
public int getInParameterCount() {
return paramValues.length;
--- 27,48 ----
*
* @author Oliver Jowett (oliver@opencloud.com)
*/
! class SimpleParameterList implements ParameterList
! {
!
!
SimpleParameterList(int paramCount) {
this.paramValues = new Object[paramCount];
+
}
! public void registerOutParameter(int index, int sqlType )
! {
!
! };
! public void registerOutParameter(int index, int sqlType, int precision )
! {
!
! };
public int getInParameterCount() {
return paramValues.length;
***************
*** 41,46 ****
--- 51,60 ----
{
return paramValues.length;
}
+ public int getOutParameterCount()
+ {
+ return 1;
+ }
public int[] getTypeOIDs() {
return null;
}
***************
*** 76,82 ****
public void setBytea(int index, byte[] data, int offset, int length) throws SQLException {
if (index < 1 || index > paramValues.length)
throw new PSQLException(GT.tr("The column index is out of range: {0}, number of columns: {1}.", new Object[]{new Integer(index), new Integer(paramValues.length)}), PSQLState.INVALID_PARAMETER_VALUE );
!
paramValues[index - 1] = new StreamWrapper(data, offset, length);
}
--- 90,96 ----
public void setBytea(int index, byte[] data, int offset, int length) throws SQLException {
if (index < 1 || index > paramValues.length)
throw new PSQLException(GT.tr("The column index is out of range: {0}, number of columns: {1}.", new Object[]{new Integer(index), new Integer(paramValues.length)}), PSQLState.INVALID_PARAMETER_VALUE );
!
paramValues[index - 1] = new StreamWrapper(data, offset, length);
}
***************
*** 90,96 ****
public void setNull(int index, int oid) throws SQLException {
if (index < 1 || index > paramValues.length)
throw new PSQLException(GT.tr("The column index is out of range: {0}, number of columns: {1}.", new Object[]{new Integer(index), new Integer(paramValues.length)}), PSQLState.INVALID_PARAMETER_VALUE );
!
paramValues[index - 1] = NULL_OBJECT;
}
--- 104,110 ----
public void setNull(int index, int oid) throws SQLException {
if (index < 1 || index > paramValues.length)
throw new PSQLException(GT.tr("The column index is out of range: {0}, number of columns: {1}.", new Object[]{new Integer(index), new Integer(paramValues.length)}), PSQLState.INVALID_PARAMETER_VALUE );
!
paramValues[index - 1] = NULL_OBJECT;
}
***************
*** 147,153 ****
void checkAllParametersSet() throws SQLException {
for (int i = 0; i < paramValues.length; i++)
{
! if (paramValues[i] == null)
throw new PSQLException(GT.tr("No value specified for parameter {0}.", new Integer(i + 1)), PSQLState.INVALID_PARAMETER_VALUE);
}
}
--- 161,167 ----
void checkAllParametersSet() throws SQLException {
for (int i = 0; i < paramValues.length; i++)
{
! if ( paramValues[i] == null)
throw new PSQLException(GT.tr("No value specified for parameter {0}.", new Integer(i + 1)), PSQLState.INVALID_PARAMETER_VALUE);
}
}
Index: org/postgresql/core/v3/CompositeParameterList.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/core/v3/CompositeParameterList.java,v
retrieving revision 1.8
diff -c -r1.8 CompositeParameterList.java
*** org/postgresql/core/v3/CompositeParameterList.java 4 Jul 2005 18:50:29 -0000 1.8
--- org/postgresql/core/v3/CompositeParameterList.java 21 May 2006 11:06:06 -0000
***************
*** 52,61 ****
{
return total;
}
! public int getInParameterCount() {
return total;
}
!
public int[] getTypeOIDs() {
int oids[] = new int[total];
for (int i=0; i<offsets.length; i++) {
--- 52,65 ----
{
return total;
}
! public int getInParameterCount()
! {
return total;
}
! public int getOutParameterCount()
! {
! return 0;
! }
public int[] getTypeOIDs() {
int oids[] = new int[total];
for (int i=0; i<offsets.length; i++) {
Index: org/postgresql/core/v3/SimpleParameterList.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/core/v3/SimpleParameterList.java,v
retrieving revision 1.11
diff -c -r1.11 SimpleParameterList.java
*** org/postgresql/core/v3/SimpleParameterList.java 24 Nov 2005 06:18:28 -0000 1.11
--- org/postgresql/core/v3/SimpleParameterList.java 21 May 2006 11:06:06 -0000
***************
*** 71,80 ****
{
return paramValues.length;
}
public int getInParameterCount()
{
int count=0;
! for( int i=0; i< paramTypes.length;i++)
{
if (direction[i] != OUT )
{
--- 71,93 ----
{
return paramValues.length;
}
+ public int getOutParameterCount()
+ {
+ int count=0;
+ for( int i=paramTypes.length; --i >= 0;)
+ {
+ if ((direction[i] & OUT) == OUT )
+ {
+ count++;
+ }
+ }
+ return count;
+
+ }
public int getInParameterCount()
{
int count=0;
! for( int i=paramTypes.length; --i >= 0;)
{
if (direction[i] != OUT )
{
***************
*** 126,132 ****
public void checkAllParametersSet() throws SQLException {
for (int i = 0; i < paramTypes.length; ++i)
{
! if (direction[i] != OUT && paramValues[i] == null)
throw new PSQLException(GT.tr("No value specified for parameter {0}.", new Integer(i + 1)), PSQLState.INVALID_PARAMETER_VALUE);
}
}
--- 139,145 ----
public void checkAllParametersSet() throws SQLException {
for (int i = 0; i < paramTypes.length; ++i)
{
! if ((direction[i]&OUT) != OUT && paramValues[i] == null)
throw new PSQLException(GT.tr("No value specified for parameter {0}.", new Integer(i + 1)), PSQLState.INVALID_PARAMETER_VALUE);
}
}
Index: org/postgresql/jdbc2/AbstractJdbc2Statement.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java,v
retrieving revision 1.88
diff -c -r1.88 AbstractJdbc2Statement.java
*** org/postgresql/jdbc2/AbstractJdbc2Statement.java 1 Feb 2006 18:52:13 -0000 1.88
--- org/postgresql/jdbc2/AbstractJdbc2Statement.java 21 May 2006 11:06:09 -0000
***************
*** 138,145 ****
this.preparedQuery = connection.getQueryExecutor().createParameterizedQuery(parsed_sql);
this.preparedParameters = preparedQuery.createParameterList();
! this.testReturn = new int[preparedParameters.getInParameterCount()+1];
! this.functionReturnType = new int[preparedParameters.getInParameterCount()+1];
resultsettype = rsType;
--- 138,146 ----
this.preparedQuery = connection.getQueryExecutor().createParameterizedQuery(parsed_sql);
this.preparedParameters = preparedQuery.createParameterList();
! int inParamCount = preparedParameters.getInParameterCount() + 1;
! this.testReturn = new int[inParamCount];
! this.functionReturnType = new int[inParamCount];
resultsettype = rsType;
***************
*** 366,392 ****
// figure out how many columns
int cols = rs.getMetaData().getColumnCount();
! callResult = new Object[cols];
// move them into the result set
! for ( int i=0; i < cols; i++)
{
! callResult[i] = rs.getObject(i+1);
! int columnType = rs.getMetaData().getColumnType(1);
! if (columnType != functionReturnType[i])
{
// this is here for the sole purpose of passing the cts
! if ( columnType == Types.DOUBLE && functionReturnType[i] == Types.REAL )
{
// return it as a float
! if ( callResult[i] != null)
! callResult[i] = new Float(((Double)callResult[i]).floatValue());
}
else
{
! throw new PSQLException (GT.tr("A CallableStatement function was executed and the return was of type {0} however type {1} was registered.",
! new Object[]{
! "java.sql.Types=" + columnType, "java.sql.Types=" + functionReturnType[i] }),
PSQLState.DATA_TYPE_MISMATCH);
}
}
--- 367,407 ----
// figure out how many columns
int cols = rs.getMetaData().getColumnCount();
!
! int outParameterCount = preparedParameters.getOutParameterCount() ;
!
! if ( cols != outParameterCount )
! throw new PSQLException(GT.tr("A CallableStatement was excecuted with an invalid number of parameters"),PSQLState.SYNTAX_ERROR);
!
! // allocate enough space for all possible parameters without regard to in/out
! callResult = new Object[preparedParameters.getParameterCount()+1];
// move them into the result set
! for ( int i=0,j=0; i < cols; i++,j++)
{
! // find the next out parameter, the assumption is that the functionReturnType
! // array will be initialized with 0 and only out parameters will have values
! // other than 0. 0 is the value for java.sql.Types.NULL, which should not
! // conflict
! while( j< functionReturnType.length && functionReturnType[j]==0) j++;
!
! callResult[j] = rs.getObject(i+1);
! int columnType = rs.getMetaData().getColumnType(i+1);
!
! if (columnType != functionReturnType[j])
{
// this is here for the sole purpose of passing the cts
! if ( columnType == Types.DOUBLE && functionReturnType[j] == Types.REAL )
{
// return it as a float
! if ( callResult[j] != null)
! callResult[j] = new Float(((Double)callResult[j]).floatValue());
}
else
{
! throw new PSQLException (GT.tr("A CallableStatement function was executed and the out parameter {0} was of type {1} however type {2} was registered.",
! new Object[]{""+i+1,
! "java.sql.Types=" + columnType, "java.sql.Types=" + functionReturnType[j] }),
PSQLState.DATA_TYPE_MISMATCH);
}
}
Index: org/postgresql/test/jdbc2/CallableStmtTest.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/jdbc2/CallableStmtTest.java,v
retrieving revision 1.18
diff -c -r1.18 CallableStmtTest.java
*** org/postgresql/test/jdbc2/CallableStmtTest.java 14 Dec 2005 14:26:08 -0000 1.18
--- org/postgresql/test/jdbc2/CallableStmtTest.java 21 May 2006 11:06:09 -0000
***************
*** 9,14 ****
--- 9,15 ----
*/
package org.postgresql.test.jdbc2;
+ import org.postgresql.Driver;
import org.postgresql.test.TestUtil;
import java.sql.*;
***************
*** 21,27 ****
public class CallableStmtTest extends TestCase
{
private Connection con;
!
public CallableStmtTest (String name)
{
super(name);
--- 22,28 ----
public class CallableStmtTest extends TestCase
{
private Connection con;
!
public CallableStmtTest (String name)
{
super(name);
Index: org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java,v
retrieving revision 1.1
diff -c -r1.1 Jdbc3CallableStatementTest.java
*** org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java 4 Jul 2005 19:19:31 -0000 1.1
--- org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java 21 May 2006 11:06:10 -0000
***************
*** 11,20 ****
--- 11,23 ----
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+ import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
+ import org.postgresql.Driver;
import org.postgresql.test.TestUtil;
+ import org.postgresql.util.PSQLState;
import junit.framework.TestCase;
***************
*** 26,31 ****
--- 29,35 ----
*/
public class Jdbc3CallableStatementTest extends TestCase
{
+
Connection con;
/* (non-Javadoc)
***************
*** 37,44 ****
Statement stmt = con.createStatement ();
stmt.execute("create temp table numeric_tab (MAX_VAL NUMERIC(30,15), MIN_VAL NUMERIC(30,15), NULL_VAL NUMERIC(30,15) NULL)");
stmt.execute("insert into numeric_tab values ( 999999999999999,0.000000000000001, null)");
! boolean ret = stmt.execute("create or replace function "
+ "Numeric_Proc( OUT IMAX NUMERIC(30,15), OUT IMIN NUMERIC(30,15), OUT INUL NUMERIC(30,15)) as "
+ "'begin "
+ "select max_val into imax from numeric_tab;"
--- 41,50 ----
Statement stmt = con.createStatement ();
stmt.execute("create temp table numeric_tab (MAX_VAL NUMERIC(30,15), MIN_VAL NUMERIC(30,15), NULL_VAL NUMERIC(30,15) NULL)");
stmt.execute("insert into numeric_tab values ( 999999999999999,0.000000000000001, null)");
+ stmt.execute("CREATE OR REPLACE FUNCTION myiofunc(a INOUT int, b OUT int) AS 'BEGIN b := a; a := 1; END;' LANGUAGE plpgsql");
+ stmt.execute("CREATE OR REPLACE FUNCTION myif(a INOUT int, b IN int) AS 'BEGIN a := b; END;' LANGUAGE plpgsql");
! stmt.execute("create or replace function "
+ "Numeric_Proc( OUT IMAX NUMERIC(30,15), OUT IMIN NUMERIC(30,15), OUT INUL NUMERIC(30,15)) as "
+ "'begin "
+ "select max_val into imax from numeric_tab;"
***************
*** 48,54 ****
--- 54,87 ----
+ " end;' "
+ "language 'plpgsql';");
+ stmt.execute( "CREATE OR REPLACE FUNCTION test_somein_someout("
+ + "pa IN int4,"
+ + "pb OUT varchar,"
+ + "pc OUT int8)"
+ + " AS "
+
+ + "'begin "
+ + "pb := ''out'';"
+ + "pc := pa + 1;"
+ + "end;'"
+ + "LANGUAGE 'plpgsql' VOLATILE;"
+
+ );
+ stmt.execute("CREATE OR REPLACE FUNCTION test_allinout("
+ + "pa INOUT int4,"
+ + "pb INOUT varchar,"
+ + "pc INOUT int8)"
+ + " AS "
+ + "'begin "
+ + "pa := pa + 1;"
+ + "pb := ''foo out'';"
+ + "pc := pa + 1;"
+ + "end;'"
+ + "LANGUAGE 'plpgsql' VOLATILE;"
+ );
+
+
}
/* (non-Javadoc)
* @see junit.framework.TestCase#tearDown()
***************
*** 57,70 ****
{
Statement stmt = con.createStatement();
stmt.execute("drop function Numeric_Proc(out decimal, out decimal, out decimal)");
stmt.close();
}
! public void testNumeric() throws Throwable
{
try
{
CallableStatement call = con.prepareCall( "{ call Numeric_Proc(?,?,?) }" ) ;
call.registerOutParameter(1,Types.NUMERIC,15);
--- 90,171 ----
{
Statement stmt = con.createStatement();
stmt.execute("drop function Numeric_Proc(out decimal, out decimal, out decimal)");
+ stmt.execute("drop function test_somein_someout(int4)");
+ stmt.execute("drop function test_allinout( inout int4, inout varchar, inout int8)");
+ stmt.execute("drop function myiofunc(a INOUT int, b OUT int) ");
+ stmt.execute("drop function myif(a INOUT int, b IN int)");
stmt.close();
}
+ public void testSomeInOut() throws Throwable
+ {
+
+
+ CallableStatement call = con.prepareCall( "{ call test_somein_someout(?,?,?) }" ) ;
+
+ call.registerOutParameter(2,Types.VARCHAR);
+ call.registerOutParameter(3,Types.BIGINT);
+ call.setInt(1,20);
+ call.execute();
! }
! public void testNotEnoughParameters() throws Throwable
! {
!
! CallableStatement cs = con.prepareCall("{call myiofunc(?,?)}");
! cs.setInt(1,2);
! cs.registerOutParameter(2,Types.INTEGER);
! try
! {
! cs.execute();
! fail("Should throw an exception ");
! }
! catch( SQLException ex)
! {
! assertTrue(ex.getSQLState().equalsIgnoreCase(PSQLState.SYNTAX_ERROR.getState()));
! }
!
! }
! public void testTooManyParameters() throws Throwable
{
+
+ CallableStatement cs = con.prepareCall("{call myif(?,?)}");
try
{
+ cs.setInt(1,1);
+ cs.setInt(2,2);
+ cs.registerOutParameter(1,Types.INTEGER);
+ cs.registerOutParameter(2,Types.INTEGER);
+ cs.execute();
+ fail("should throw an exception");
+ }
+ catch( SQLException ex )
+ {
+ assertTrue(ex.getSQLState().equalsIgnoreCase(PSQLState.SYNTAX_ERROR.getState()));
+ }
+
+ }
+ public void testAllInOut() throws Throwable
+ {
+
+ CallableStatement call = con.prepareCall( "{ call test_allinout(?,?,?) }" ) ;
+
+ call.registerOutParameter(1,Types.INTEGER);
+ call.registerOutParameter(2,Types.VARCHAR);
+ call.registerOutParameter(3,Types.BIGINT);
+ call.setInt(1,20);
+ call.setString(2,"hi");
+ call.setInt(3,123);
+ call.execute();
+ call.getInt(1);
+ call.getString(2);
+ call.getLong(3);
+
+ }
+
+ public void testNumeric() throws Throwable
+ {
+
CallableStatement call = con.prepareCall( "{ call Numeric_Proc(?,?,?) }" ) ;
call.registerOutParameter(1,Types.NUMERIC,15);
***************
*** 78,84 ****
ret=call.getBigDecimal(2);
assertTrue ("correct return from getNumeric ()",
! ret.equals (new java.math.BigDecimal("0.000000000000001")));
try
{
ret = call.getBigDecimal(3);
--- 179,185 ----
ret=call.getBigDecimal(2);
assertTrue ("correct return from getNumeric ()",
! ret.equals (new java.math.BigDecimal("0.000000000000001")));
try
{
ret = call.getBigDecimal(3);
***************
*** 87,120 ****
assertTrue("This should be null",call.wasNull());
}
! }
! catch(Exception ex)
! {
! fail(ex.getMessage());
! }
}
public void testGetObjectDecimal() throws Throwable
{
try
{
! Statement stmt = con.createStatement();
! stmt.execute("create temp table decimal_tab ( max_val numeric(30,15), min_val numeric(30,15), nul_val numeric(30,15) )");
! stmt.execute("insert into decimal_tab values (999999999999999.000000000000000,0.000000000000001,null)");
! boolean ret = stmt.execute("create or replace function "
! + "decimal_proc( OUT pmax numeric, OUT pmin numeric, OUT nval numeric) as "
! + "'begin "
! + "select max_val into pmax from decimal_tab;"
! + "select min_val into pmin from decimal_tab;"
! + "select nul_val into nval from decimal_tab;"
!
! + " end;' "
! + "language 'plpgsql';");
}
catch (Exception ex)
{
fail ( ex.getMessage());
throw ex;
}
try
{
CallableStatement cstmt = con.prepareCall("{ call decimal_proc(?,?,?) }");
--- 188,220 ----
assertTrue("This should be null",call.wasNull());
}
!
!
}
public void testGetObjectDecimal() throws Throwable
{
try
{
! Statement stmt = con.createStatement();
! stmt.execute("create temp table decimal_tab ( max_val numeric(30,15), min_val numeric(30,15), nul_val numeric(30,15) )");
! stmt.execute("insert into decimal_tab values (999999999999999.000000000000000,0.000000000000001,null)");
!
! boolean ret = stmt.execute("create or replace function "
! + "decimal_proc( OUT pmax numeric, OUT pmin numeric, OUT nval numeric) as "
! + "'begin "
! + "select max_val into pmax from decimal_tab;"
! + "select min_val into pmin from decimal_tab;"
! + "select nul_val into nval from decimal_tab;"
!
! + " end;' "
! + "language 'plpgsql';");
}
catch (Exception ex)
{
fail ( ex.getMessage());
throw ex;
}
+
try
{
CallableStatement cstmt = con.prepareCall("{ call decimal_proc(?,?,?) }");
***************
*** 234,243 ****
cstmt.getBoolean(3);
assertTrue(cstmt.wasNull());
}
! catch ( Exception ex )
! {
! fail(ex.getMessage());
! }
finally
{
try
--- 334,340 ----
cstmt.getBoolean(3);
assertTrue(cstmt.wasNull());
}
!
finally
{
try
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-27 16:01 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-28 02:15 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-01 22:47 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-04 05:02 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-04 15:08 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-11 00:52 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-11 02:24 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-11 03:11 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-21 12:00 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
@ 2006-05-22 10:05 ` Kris Jurka <books@ejurka.com>
2006-05-23 19:31 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-11-03 04:50 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
0 siblings, 2 replies; 21+ messages in thread
From: Kris Jurka @ 2006-05-22 10:05 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: pgsql-jdbc
On Sun, 21 May 2006, Dave Cramer wrote:
> Attached is a patch that works on 8.1 and 7.3 for sure
>
Applied to 8.1 and HEAD. In the future please take more care that your
editor does not make superfluous changes to the code. There were a number
of whitespace, bracket position, and other changes that make a diff harder
to read.
In testing I found some other related bugs regarding trying to retrieve
results that are not available as the attached test cases demonstrate.
Kris Jurka
Attachments:
cs-fetch-no-data-test.patch (text/plain, 1.4K) download
Index: org/postgresql/test/jdbc2/CallableStmtTest.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/jdbc2/CallableStmtTest.java,v
retrieving revision 1.18
diff -c -r1.18 CallableStmtTest.java
*** org/postgresql/test/jdbc2/CallableStmtTest.java 14 Dec 2005 14:26:08 -0000 1.18
--- org/postgresql/test/jdbc2/CallableStmtTest.java 22 May 2006 10:04:42 -0000
***************
*** 175,180 ****
--- 175,203 ----
assertEquals(1, call.getInt(1));
}
+ public void testFetchBeforeExecute() throws SQLException {
+ CallableStatement cs = con.prepareCall("{? = call lower(?)}");
+ cs.registerOutParameter(1, Types.VARCHAR);
+ cs.setString(2, "Hi");
+ try {
+ cs.getString(1);
+ fail("expected exception");
+ } catch(Exception e) {
+ assertTrue(e instanceof SQLException);
+ }
+ }
+
+ public void testFetchWithNoResults() throws SQLException {
+ CallableStatement cs = con.prepareCall("{call now()}");
+ cs.execute();
+ try {
+ cs.getObject(1);
+ fail("expected exception");
+ } catch(Exception e) {
+ assertTrue(e instanceof SQLException);
+ }
+ }
+
public void testBadStmt () throws Throwable
{
tryOneBadStmt ("{ ?= " + pkgName + "getString (?) }");
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-27 16:01 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-28 02:15 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-01 22:47 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-04 05:02 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-04 15:08 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-11 00:52 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-11 02:24 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-11 03:11 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-21 12:00 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-22 10:05 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
@ 2006-05-23 19:31 ` Kris Jurka <books@ejurka.com>
2006-05-23 20:30 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
1 sibling, 1 reply; 21+ messages in thread
From: Kris Jurka @ 2006-05-23 19:31 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: pgsql-jdbc
On Mon, 22 May 2006, Kris Jurka wrote:
> On Sun, 21 May 2006, Dave Cramer wrote:
>
>> Attached is a patch that works on 8.1 and 7.3 for sure
>>
>
> Applied to 8.1 and HEAD.
Unfortunately it does not work when run against a 8.0 server.
Kris Jurka
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-27 16:01 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-28 02:15 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-01 22:47 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-04 05:02 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-04 15:08 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-11 00:52 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-11 02:24 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-11 03:11 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-21 12:00 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-22 10:05 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-23 19:31 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
@ 2006-05-23 20:30 ` Kris Jurka <books@ejurka.com>
2006-05-23 21:59 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 21+ messages in thread
From: Kris Jurka @ 2006-05-23 20:30 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: pgsql-jdbc
On Tue, 23 May 2006, Kris Jurka wrote:
>> On Sun, 21 May 2006, Dave Cramer wrote:
>>
>>> Attached is a patch that works on 8.1 and 7.3 for sure
>>>
>
> Unfortunately it does not work when run against a 8.0 server.
>
The issues is that every function call will have at least one out
parameter whether it's been registered or not. For pre 8.1 servers
using the v3 protocol the out parameter was not being registered in the
SimpleParameterList and can't be because of lack of server support.
The patch adjusts getOutParameterCount to return at least 1.
I need to do some more careful testing after the recent bad releases, but
hopefully I'll put out new 8.0 and 8.1 releases tonight.
Kris Jurka
Attachments:
out-params-pre81-v3.patch (text/plain, 711B) download
Index: org/postgresql/core/v3/SimpleParameterList.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/core/v3/SimpleParameterList.java,v
retrieving revision 1.12
diff -c -r1.12 SimpleParameterList.java
*** org/postgresql/core/v3/SimpleParameterList.java 22 May 2006 09:52:37 -0000 1.12
--- org/postgresql/core/v3/SimpleParameterList.java 23 May 2006 20:25:08 -0000
***************
*** 81,86 ****
--- 81,89 ----
count++;
}
}
+ // Every function has at least one output.
+ if (count == 0)
+ count = 1;
return count;
}
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-27 16:01 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-28 02:15 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-01 22:47 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-04 05:02 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-04 15:08 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-11 00:52 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-11 02:24 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-11 03:11 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-21 12:00 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-22 10:05 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-23 19:31 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-23 20:30 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
@ 2006-05-23 21:59 ` Dave Cramer <pg@fastcrypt.com>
0 siblings, 0 replies; 21+ messages in thread
From: Dave Cramer @ 2006-05-23 21:59 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc
Yeah,
The whole out parameters thing is a bit screwy since we don't support
real parameters.
This makes sense as it's pretty much the same as what I did for the
7.3 server.
Dave
On 23-May-06, at 4:30 PM, Kris Jurka wrote:
>
>
> On Tue, 23 May 2006, Kris Jurka wrote:
>
>>> On Sun, 21 May 2006, Dave Cramer wrote:
>>>> Attached is a patch that works on 8.1 and 7.3 for sure
>>
>> Unfortunately it does not work when run against a 8.0 server.
>>
>
> The issues is that every function call will have at least one out
> parameter whether it's been registered or not. For pre 8.1 servers
> using the v3 protocol the out parameter was not being registered in
> the SimpleParameterList and can't be because of lack of server
> support. The patch adjusts getOutParameterCount to return at least 1.
>
> I need to do some more careful testing after the recent bad
> releases, but hopefully I'll put out new 8.0 and 8.1 releases tonight.
>
> Kris Jurka
> <out-params-pre81-v3.patch>
^ permalink raw reply [nested|flat] 21+ messages in thread
* Re: Bug with callable statement and output parameters
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Re: Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-04-27 16:01 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-04-28 02:15 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-01 22:47 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-04 05:02 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-04 15:08 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-11 00:52 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-11 02:24 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-11 03:11 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
2006-05-21 12:00 ` Re: Bug with callable statement and output parameters Dave Cramer <pg@fastcrypt.com>
2006-05-22 10:05 ` Re: Bug with callable statement and output parameters Kris Jurka <books@ejurka.com>
@ 2006-11-03 04:50 ` Kris Jurka <books@ejurka.com>
1 sibling, 0 replies; 21+ messages in thread
From: Kris Jurka @ 2006-11-03 04:50 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: pgsql-jdbc
On Mon, 22 May 2006, Kris Jurka wrote:
> In testing I found some other related bugs regarding trying to retrieve
> results that are not available as the attached test cases demonstrate.
>
I've fixed the following three problem cases for CallableStatements in CVS
HEAD.
1) Calling wasNull before fetching anything threw an
ArrayIndexOutOfBoundsException.
2) Fetching data before executing the statement threw a
NullPointerException.
3) Fetching data when nothing was registered to be returned threw a
NullPointerException.
Kris Jurka
^ permalink raw reply [nested|flat] 21+ messages in thread
end of thread, other threads:[~2006-11-03 04:50 UTC | newest]
Thread overview: 21+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-04-20 22:02 Bug with callable statement and output parameters Luis Londono <somakani@gmail.com>
2006-04-20 23:29 ` Dave Cramer <pg@fastcrypt.com>
2006-04-21 00:03 ` Luis Londono <somakani@gmail.com>
2006-04-21 11:27 ` Dave Cramer <pg@fastcrypt.com>
2006-04-26 20:51 ` Kris Jurka <books@ejurka.com>
2006-04-26 23:37 ` Kris Jurka <books@ejurka.com>
2006-04-27 16:01 ` Dave Cramer <pg@fastcrypt.com>
2006-04-28 02:15 ` Kris Jurka <books@ejurka.com>
2006-04-28 12:00 ` Dave Cramer <pg@fastcrypt.com>
2006-05-01 22:47 ` Dave Cramer <pg@fastcrypt.com>
2006-05-04 05:02 ` Kris Jurka <books@ejurka.com>
2006-05-04 15:08 ` Dave Cramer <pg@fastcrypt.com>
2006-05-11 00:52 ` Kris Jurka <books@ejurka.com>
2006-05-11 02:24 ` Dave Cramer <pg@fastcrypt.com>
2006-05-11 03:11 ` Kris Jurka <books@ejurka.com>
2006-05-21 12:00 ` Dave Cramer <pg@fastcrypt.com>
2006-05-22 10:05 ` Kris Jurka <books@ejurka.com>
2006-05-23 19:31 ` Kris Jurka <books@ejurka.com>
2006-05-23 20:30 ` Kris Jurka <books@ejurka.com>
2006-05-23 21:59 ` Dave Cramer <pg@fastcrypt.com>
2006-11-03 04:50 ` Kris Jurka <books@ejurka.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox