From: Dave Cramer <pg@fastcrypt.com>
To: Barry Lind <blind@xythos.com>
Cc: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: multiple out parameters implementation
Date: Thu, 16 Sep 2004 12:28:39 -0400
Message-ID: <1095352119.1622.398.camel@localhost.localdomain> (raw)
In-Reply-To: <03E7D3E231BB7B4A915A6581D4296CC69796EE@NSNOVPS00411.nacio.xythos.com>
References: <03E7D3E231BB7B4A915A6581D4296CC69796EE@NSNOVPS00411.nacio.xythos.com>
Barry, Kris,
The "hack" is much smaller now thanks to Oliver's changes in the
backend.
It's now only minor changes.
Although, at this point nobody has asked for it. That might change once
8.1 supports them and people start expecting the same behaviour in
previous versions.
Attached is the proof of concept patch, which when I look at it is
larger than I remembered, but alot of the changes would be compatible,
ie all of the changes to getXXX()
Dave
On Thu, 2004-09-16 at 12:01, Barry Lind wrote:
> I agree with Kris' reasoning. I haven't liked this hack from the day it
> was first proposed by Redhat/Fijitsu. I had come to accept it as a
> necessary evil since I had given up on the backend ever supporting this
> natively.
>
> The best situation would be to have this in the backend. Second best
> would be to implement Dave's changes and have the backend never support
> it. Worst would be to have two incompatible implementations (in both
> the driver and the backend) (think bytea vs LO but worse since I am not
> sure it would be possible to toggle between two different ways of
> dealing with multiple out parameters).
>
> --Barry
>
>
> -----Original Message-----
> From: Kris Jurka [mailto:books@ejurka.com]
> Sent: Thursday, September 16, 2004 2:01 AM
> To: Dave Cramer
> Cc: pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] multiple out parameters implementation
>
>
>
> On Wed, 1 Sep 2004, Dave Cramer wrote:
>
> > I've managed to hack into the jdbc driver the capability for multiple
> > out parameters from a postgresql function.
> >
> > I would like to query the list as to their thoughts, is this a useful
> > feature for the driver ?
> >
>
> This is a useful feature because it's currently the only way to port
> certain things, but it's clearly not very straightforward and it causes
> some non trivial thinking on the parts of the database and Java
> developers to get their code to match up.
>
> Until just today I was in favor of this as we don't have any other
> options or any hope for a real procedure interface in the near future,
> but today on -hackers Gavin Sherry and Neil Conway indicated that they
> have a proposal for implementing this feature in the backend. I'd say
> lets take a look at the proposal and if we believe they've got a decent
> shot at getting this in 8.1 then we hold off on this hack. The method
> you proposed is pretty complicated and would introduce a pretty bad
> backwards compatibility problem.
>
> Kris Jurka
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
--
Dave Cramer
519 939 0336
ICQ # 14675561
www.postgresintl.com
Attachments:outparm.diff (text/x-patch, 21.6K) download
Index: org/postgresql/jdbc2/AbstractJdbc2Statement.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java,v
retrieving revision 1.29
diff -c -B -b -r1.29 AbstractJdbc2Statement.java
*** org/postgresql/jdbc2/AbstractJdbc2Statement.java 10 Aug 2004 11:27:28 -0000 1.29
--- org/postgresql/jdbc2/AbstractJdbc2Statement.java 1 Sep 2004 01:19:24 -0000
***************
*** 72,82 ****
// functionReturnType contains the user supplied value to check
// testReturn contains a modified version to make it easier to
// check the getXXX methods..
! private int functionReturnType;
! private int testReturn;
// returnTypeSet is true when a proper call to registerOutParameter has been made
private boolean returnTypeSet;
! protected Object callResult;
protected int maxfieldSize = 0;
public ResultSet createDriverResultSet(Field[] fields, Vector tuples)
--- 72,83 ----
// functionReturnType contains the user supplied value to check
// testReturn contains a modified version to make it easier to
// check the getXXX methods..
! private int []functionReturnType;
! private int []testReturn;
// returnTypeSet is true when a proper call to registerOutParameter has been made
private boolean returnTypeSet;
! protected Object []callResult;
!
protected int maxfieldSize = 0;
public ResultSet createDriverResultSet(Field[] fields, Vector tuples)
***************
*** 105,110 ****
--- 106,114 ----
this.preparedQuery = connection.getQueryExecutor().createParameterizedQuery(parsed_sql);
this.preparedParameters = preparedQuery.createParameterList();
+ testReturn = new int[preparedParameters.getParameterCount()+1];+ functionReturnType = new int[preparedParameters.getParameterCount()+1];+
resultsettype = rsType;
concurrency = rsConcurrency;
}
***************
*** 303,314 ****
if (!rs.next())
throw new PSQLException ("postgresql.call.noreturnval", PSQLState.NO_DATA);
! callResult = rs.getObject(1);
int columnType = rs.getMetaData().getColumnType(1);
! if (columnType != functionReturnType)
throw new PSQLException ("postgresql.call.wrongrtntype", PSQLState.DATA_TYPE_MISMATCH, null,
new Object[]{
"java.sql.Types=" + columnType, "java.sql.Types=" + functionReturnType });
rs.close();
result = null;
--- 307,326 ----
if (!rs.next())
throw new PSQLException ("postgresql.call.noreturnval", PSQLState.NO_DATA);
! // 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])
throw new PSQLException ("postgresql.call.wrongrtntype", PSQLState.DATA_TYPE_MISMATCH, null,
new Object[]{
"java.sql.Types=" + columnType, "java.sql.Types=" + functionReturnType });
+ }
rs.close();
result = null;
***************
*** 375,380 ****
--- 387,393 ----
}
private boolean isClosed = false;
+ private int lastIndex = 0;
/*
* getUpdateCount returns the current result as an update count,
***************
*** 1556,1576 ****
public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
{
checkClosed();
if (parameterIndex != 1)
throw new PSQLException ("postgresql.call.noinout", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
if (!isFunction)
throw new PSQLException ("postgresql.call.procasfunc", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
// functionReturnType contains the user supplied value to check
// testReturn contains a modified version to make it easier to
// check the getXXX methods..
! functionReturnType = sqlType;
! testReturn = sqlType;
! if (functionReturnType == Types.CHAR ||
! functionReturnType == Types.LONGVARCHAR)
! testReturn = Types.VARCHAR;
! else if (functionReturnType == Types.FLOAT)
! testReturn = Types.REAL; // changes to streamline later error checking
returnTypeSet = true;
}
--- 1569,1595 ----
public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
{
checkClosed();
+ /*
if (parameterIndex != 1)
throw new PSQLException ("postgresql.call.noinout", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
+ }+ */+
if (!isFunction)
throw new PSQLException ("postgresql.call.procasfunc", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
// functionReturnType contains the user supplied value to check
// testReturn contains a modified version to make it easier to
// check the getXXX methods..
! functionReturnType[parameterIndex-1] = sqlType;
! testReturn[parameterIndex-1] = sqlType;
!
! if (functionReturnType[parameterIndex-1] == Types.CHAR ||
! functionReturnType[parameterIndex-1] == Types.LONGVARCHAR)
! testReturn[parameterIndex-1] = Types.VARCHAR;
! else if (functionReturnType[parameterIndex-1] == Types.FLOAT)
! testReturn[parameterIndex-1] = Types.REAL; // changes to streamline later error checking
!
returnTypeSet = true;
}
***************
*** 1605,1611 ****
public boolean wasNull() throws SQLException
{
// check to see if the last access threw an exception
! return (callResult == null);
}
/*
--- 1624,1630 ----
public boolean wasNull() throws SQLException
{
// check to see if the last access threw an exception
! return (callResult[lastIndex-1] == null);
}
/*
***************
*** 1620,1626 ****
{
checkClosed();
checkIndex (parameterIndex, Types.VARCHAR, "String");
! return (String)callResult;
}
--- 1639,1645 ----
{
checkClosed();
checkIndex (parameterIndex, Types.VARCHAR, "String");
! return (String)callResult[parameterIndex-1];
}
***************
*** 1637,1643 ****
checkIndex (parameterIndex, Types.BIT, "Boolean");
if (callResult == null)
return false;
! return ((Boolean)callResult).booleanValue ();
}
/*
--- 1656,1662 ----
checkIndex (parameterIndex, Types.BIT, "Boolean");
if (callResult == null)
return false;
! return ((Boolean)callResult[parameterIndex-1]).booleanValue ();
}
/*
***************
*** 1653,1659 ****
checkIndex (parameterIndex, Types.TINYINT, "Byte");
if (callResult == null)
return 0;
! return (byte)((Integer)callResult).intValue ();
}
/*
--- 1672,1678 ----
checkIndex (parameterIndex, Types.TINYINT, "Byte");
if (callResult == null)
return 0;
! return (byte)((Integer)callResult[parameterIndex-1]).intValue ();
}
/*
***************
*** 1669,1675 ****
checkIndex (parameterIndex, Types.SMALLINT, "Short");
if (callResult == null)
return 0;
! return (short)((Integer)callResult).intValue ();
}
--- 1688,1694 ----
checkIndex (parameterIndex, Types.SMALLINT, "Short");
if (callResult == null)
return 0;
! return (short)((Integer)callResult[parameterIndex-1]).intValue ();
}
***************
*** 1686,1692 ****
checkIndex (parameterIndex, Types.INTEGER, "Int");
if (callResult == null)
return 0;
! return ((Integer)callResult).intValue ();
}
/*
--- 1705,1711 ----
checkIndex (parameterIndex, Types.INTEGER, "Int");
if (callResult == null)
return 0;
! return ((Integer)callResult[parameterIndex-1]).intValue ();
}
/*
***************
*** 1702,1708 ****
checkIndex (parameterIndex, Types.BIGINT, "Long");
if (callResult == null)
return 0;
! return ((Long)callResult).longValue ();
}
/*
--- 1721,1727 ----
checkIndex (parameterIndex, Types.BIGINT, "Long");
if (callResult == null)
return 0;
! return ((Long)callResult[parameterIndex-1]).longValue ();
}
/*
***************
*** 1718,1724 ****
checkIndex (parameterIndex, Types.REAL, "Float");
if (callResult == null)
return 0;
! return ((Float)callResult).floatValue ();
}
/*
--- 1737,1743 ----
checkIndex (parameterIndex, Types.REAL, "Float");
if (callResult == null)
return 0;
! return ((Float)callResult[parameterIndex-1]).floatValue ();
}
/*
***************
*** 1734,1740 ****
checkIndex (parameterIndex, Types.DOUBLE, "Double");
if (callResult == null)
return 0;
! return ((Double)callResult).doubleValue ();
}
/*
--- 1753,1759 ----
checkIndex (parameterIndex, Types.DOUBLE, "Double");
if (callResult == null)
return 0;
! return ((Double)callResult[parameterIndex-1]).doubleValue ();
}
/*
***************
*** 1753,1759 ****
{
checkClosed();
checkIndex (parameterIndex, Types.NUMERIC, "BigDecimal");
! return ((BigDecimal)callResult);
}
/*
--- 1772,1779 ----
{
checkClosed();
checkIndex (parameterIndex, Types.NUMERIC, "BigDecimal");
! setLastIndex(parameterIndex);
! return ((BigDecimal)callResult[parameterIndex-1]);
}
/*
***************
*** 1768,1774 ****
{
checkClosed();
checkIndex (parameterIndex, Types.VARBINARY, Types.BINARY, "Bytes");
! return ((byte [])callResult);
}
--- 1788,1795 ----
{
checkClosed();
checkIndex (parameterIndex, Types.VARBINARY, Types.BINARY, "Bytes");
! setLastIndex(parameterIndex);
! return ((byte [])callResult[parameterIndex-1]);
}
***************
*** 1783,1789 ****
{
checkClosed();
checkIndex (parameterIndex, Types.DATE, "Date");
! return (java.sql.Date)callResult;
}
/*
--- 1804,1811 ----
{
checkClosed();
checkIndex (parameterIndex, Types.DATE, "Date");
! setLastIndex(parameterIndex);
! return (java.sql.Date)callResult[parameterIndex-1];
}
/*
***************
*** 1797,1803 ****
{
checkClosed();
checkIndex (parameterIndex, Types.TIME, "Time");
! return (java.sql.Time)callResult;
}
/*
--- 1819,1826 ----
{
checkClosed();
checkIndex (parameterIndex, Types.TIME, "Time");
! setLastIndex(parameterIndex);
! return (java.sql.Time)callResult[parameterIndex-1];
}
/*
***************
*** 1812,1818 ****
{
checkClosed();
checkIndex (parameterIndex, Types.TIMESTAMP, "Timestamp");
! return (java.sql.Timestamp)callResult;
}
// getObject returns a Java object for the parameter.
--- 1835,1842 ----
{
checkClosed();
checkIndex (parameterIndex, Types.TIMESTAMP, "Timestamp");
! setLastIndex(parameterIndex);
! return (java.sql.Timestamp)callResult[parameterIndex-1];
}
// getObject returns a Java object for the parameter.
***************
*** 1840,1846 ****
{
checkClosed();
checkIndex (parameterIndex);
! return callResult;
}
/*
--- 1864,1871 ----
{
checkClosed();
checkIndex (parameterIndex);
! setLastIndex(parameterIndex);
! return callResult[parameterIndex-1];
}
/*
***************
*** 2051,2057 ****
throws SQLException
{
checkIndex (parameterIndex);
! if (type1 != this.testReturn && type2 != this.testReturn)
throw new PSQLException("postgresql.call.wrongget", PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH,
new Object[]{"java.sql.Types=" + testReturn,
getName,
--- 2076,2082 ----
throws SQLException
{
checkIndex (parameterIndex);
! if (type1 != this.testReturn[parameterIndex-1] && type2 != this.testReturn[parameterIndex-1])
throw new PSQLException("postgresql.call.wrongget", PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH,
new Object[]{"java.sql.Types=" + testReturn,
getName,
***************
*** 2064,2070 ****
throws SQLException
{
checkIndex (parameterIndex);
! if (type != this.testReturn)
throw new PSQLException("postgresql.call.wrongget", PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH,
new Object[]{"java.sql.Types=" + testReturn,
getName,
--- 2089,2095 ----
throws SQLException
{
checkIndex (parameterIndex);
! if (type != this.testReturn[parameterIndex-1])
throw new PSQLException("postgresql.call.wrongget", PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH,
new Object[]{"java.sql.Types=" + testReturn,
getName,
***************
*** 2079,2087 ****
--- 2104,2115 ----
{
if (!isFunction)
throw new PSQLException("postgresql.call.noreturntype", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
+ /*
if (parameterIndex != 1)
throw new PSQLException("postgresql.call.noinout", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
}
+ */+ }
public void setPrepareThreshold(int newThreshold) throws SQLException {
checkClosed();
***************
*** 2630,2641 ****
{
throw Driver.notImplemented();
}
!
public java.math.BigDecimal getBigDecimal(int parameterIndex) throws SQLException
{
checkClosed();
checkIndex (parameterIndex, Types.NUMERIC, "BigDecimal");
! return ((BigDecimal)callResult);
}
public Blob getBlob(int i) throws SQLException
--- 2658,2673 ----
{
throw Driver.notImplemented();
}
! private void setLastIndex(int index)
! {
! lastIndex = index;
! }
public java.math.BigDecimal getBigDecimal(int parameterIndex) throws SQLException
{
checkClosed();
checkIndex (parameterIndex, Types.NUMERIC, "BigDecimal");
! setLastIndex(parameterIndex);
! return ((BigDecimal)callResult[parameterIndex-1]);
}
public Blob getBlob(int i) throws SQLException
***************
*** 2660,2665 ****
--- 2692,2698 ----
public java.sql.Date getDate(int i, java.util.Calendar cal) throws SQLException
{
+ setLastIndex(i);
if (cal == null)
return getDate(i);
java.util.Date tmp = getDate(i);
***************
*** 2671,2676 ****
--- 2704,2710 ----
public Time getTime(int i, java.util.Calendar cal) throws SQLException
{
+ setLastIndex(i);
if (cal == null)
return getTime(i);
java.util.Date tmp = getTime(i);
***************
*** 2682,2687 ****
--- 2716,2722 ----
public Timestamp getTimestamp(int i, java.util.Calendar cal) throws SQLException
{
+ setLastIndex(i);
if (cal == null)
return getTimestamp(i);
java.util.Date tmp = getTimestamp(i);
Index: org/postgresql/test/TestUtil.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/TestUtil.java,v
retrieving revision 1.11
diff -c -B -b -r1.11 TestUtil.java
*** org/postgresql/test/TestUtil.java 16 Jul 2004 06:14:28 -0000 1.11
--- org/postgresql/test/TestUtil.java 1 Sep 2004 01:19:25 -0000
***************
*** 83,90 ****
props.setProperty("password",getPassword());
// this allows loads the class.
! // org.postgresql.Driver.setLogLevel(org.postgresql.Driver.DEBUG);
! // java.sql.DriverManager.setLogWriter(new java.io.PrintWriter(System.err));
return java.sql.DriverManager.getConnection(getURL(), props);
}
--- 83,92 ----
props.setProperty("password",getPassword());
// this allows loads the class.
! //org.postgresql.Driver.setLogLevel(org.postgresql.Driver.DEBUG);
! //java.sql.DriverManager.setLogWriter(new java.io.PrintWriter(System.err));
! String url = getURL();
!
return java.sql.DriverManager.getConnection(getURL(), props);
}
Index: org/postgresql/test/jdbc2/CallableStmtTest.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/jdbc2/CallableStmtTest.java,v
retrieving revision 1.5
diff -c -B -b -r1.5 CallableStmtTest.java
*** org/postgresql/test/jdbc2/CallableStmtTest.java 29 May 2003 04:39:48 -0000 1.5
--- org/postgresql/test/jdbc2/CallableStmtTest.java 1 Sep 2004 01:19:25 -0000
***************
*** 38,43 ****
--- 38,51 ----
stmt.execute ("CREATE OR REPLACE FUNCTION testspg__getNumeric (numeric) " +
"RETURNS numeric AS ' DECLARE inString alias for $1; " +
"begin return 42; end; ' LANGUAGE 'plpgsql';");
+ 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 type Numeric_Proc_RetType as(it1 numeric(30,15),it2 numeric(30,15),it3 numeric(30,15));");+ boolean ret = stmt.execute("create function "+ + "Numeric_Proc(numeric(30,15),numeric(30,15),numeric(30,15)) returns Numeric_Proc_RetType as "+ + "'declare work_ret record; begin select * into work_ret from Numeric_Tab; return work_ret; end;' "+ + "language 'plpgsql';");+ int x = stmt.getUpdateCount();
stmt.close ();
}
***************
*** 48,53 ****
--- 56,63 ----
stmt.execute ("drop FUNCTION testspg__getDouble (float);");
stmt.execute ("drop FUNCTION testspg__getInt (int);");
stmt.execute ("drop FUNCTION testspg__getNumeric (numeric);");
+ stmt.execute("drop function Numeric_Proc(numeric, numeric, numeric)");+ stmt.execute("drop type Numeric_Proc_RetType");
TestUtil.closeDB(con);
}
***************
*** 58,63 ****
--- 68,103 ----
//testGetString ();
//}
+ public void testNumeric() throws Throwable+ {+ CallableStatement call = con.prepareCall( func + "Numeric_Proc(?,?,?) }" ) ;+ + call.registerOutParameter(1,Types.NUMERIC);+ call.registerOutParameter(2,Types.NUMERIC);+ call.registerOutParameter(3,Types.NUMERIC);+ + call.setBigDecimal(2,new java.math.BigDecimal(1));+ call.setBigDecimal(3,new java.math.BigDecimal(2));+ call.setBigDecimal(4,new java.math.BigDecimal(3));+ + call.execute();+ java.math.BigDecimal ret = call.getBigDecimal(1);+ assertTrue ("correct return from getNumeric () should be 999999999999999.000000000000000 but returned " + ret.toString(),+ ret.equals (new java.math.BigDecimal("999999999999999.000000000000000")));+ + ret=call.getBigDecimal(2);+ assertTrue ("correct return from getNumeric ()",+ ret.equals (new java.math.BigDecimal("0.000000000000001")));+ try+ {+ ret = call.getBigDecimal(3);+ }catch(NullPointerException ex)+ {+ assertTrue("This should be null",call.wasNull());+ }+ + + }
public void testGetDouble () throws Throwable
{
CallableStatement call = con.prepareCall (func + pkgName + "getDouble (?) }");
Index: org/postgresql/test/jdbc2/DateTest.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/jdbc2/DateTest.java,v
retrieving revision 1.7
diff -c -B -b -r1.7 DateTest.java
*** org/postgresql/test/jdbc2/DateTest.java 29 Nov 2003 22:41:23 -0000 1.7
--- org/postgresql/test/jdbc2/DateTest.java 1 Sep 2004 01:19:25 -0000
***************
*** 59,69 ****
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1971-12-15'")));
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1984-12-03'")));
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'2000-01-01'")));
/* dateTest() contains all of the tests */
dateTest();
! assertEquals(16, stmt.executeUpdate("DELETE FROM " + "testdate"));
stmt.close();
}
catch (Exception ex)
--- 59,70 ----
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1971-12-15'")));
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1984-12-03'")));
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'2000-01-01'")));
+ assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'2000-1-1'")));
/* dateTest() contains all of the tests */
dateTest();
! assertEquals(17, stmt.executeUpdate("DELETE FROM " + "testdate"));
stmt.close();
}
catch (Exception ex)
***************
*** 130,135 ****
--- 131,141 ----
ps.setObject(1, java.sql.Date.valueOf("2000-1-1"), java.sql.Types.DATE);
assertEquals(1, ps.executeUpdate());
+ // try single digit month and day+ ps.setObject(1,"2000-1-1",java.sql.Types.DATE);+ assertEquals(1, ps.executeUpdate());+ +
ps.setObject(1, "1944-4-04-01", java.sql.Types.DATE);
assertEquals(1, ps.executeUpdate());
***************
*** 150,156 ****
dateTest();
testingSetDate = false;
! assertEquals(20, stmt.executeUpdate("DELETE FROM testdate"));
stmt.close();
}
catch (Exception ex)
--- 156,162 ----
dateTest();
testingSetDate = false;
! assertEquals(21, stmt.executeUpdate("DELETE FROM testdate"));
stmt.close();
}
catch (Exception ex)
***************
*** 251,256 ****
--- 257,268 ----
assertNotNull(d);
assertEquals(d, makeDate(2000, 1, 1));
+ assertTrue(rs.next());+ d = rs.getDate(1);+ assertNotNull(d);+ assertEquals(d, makeDate(2000, 1, 1));+ +
//now we have to convert the date, cause I fed it a timezone. IF it used it. hence the check
if (testingSetDate)
{
***************
*** 306,312 ****
tmpDate.setTime(tmpDate.getTime() + Dateoffset + localoffset);
assertEquals(d, makeDate(tmpDate.getYear() + 1900, tmpDate.getMonth()+1, tmpDate.getDate()));
}
-
assertTrue(!rs.next());
rs.close();
--- 318,323 ----
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: pg@fastcrypt.com, blind@xythos.com, books@ejurka.com
Subject: Re: multiple out parameters implementation
In-Reply-To: <1095352119.1622.398.camel@localhost.localdomain>
References: <03E7D3E231BB7B4A915A6581D4296CC69796EE@NSNOVPS00411.nacio.xythos.com> <1095352119.1622.398.camel@localhost.localdomain>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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