Skip to content

Commit 1b21ec9

Browse files
committed
Bugfix 1010968: PL/Java does not build with Java 6
Added stubs for JDBC4 to build it with Java 6.
1 parent e7eaeb4 commit 1b21ec9

16 files changed

+491
-0
lines changed

src/java/pljava/org/postgresql/pljava/jdbc/BlobValue.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
import java.io.InputStream;
1111
import java.io.IOException;
1212
import java.io.OutputStream;
13+
import java.io.Reader;
1314
import java.nio.ByteBuffer;
1415
import java.sql.Blob;
1516
import java.sql.SQLException;
17+
import java.sql.SQLFeatureNotSupportedException;
1618

1719
/**
1820
* @author Thomas Hallgren
@@ -243,4 +245,20 @@ public void truncate(long len)
243245
{
244246
throw new UnsupportedOperationException();
245247
}
248+
249+
// Start of Java 6 stubs
250+
public InputStream getBinaryStream(long pos,
251+
long length)
252+
throws SQLException
253+
{
254+
throw new SQLFeatureNotSupportedException();
255+
}
256+
257+
public void free()
258+
throws SQLException
259+
{
260+
throw new SQLFeatureNotSupportedException();
261+
}
262+
263+
// End of Java 6 stubs
246264
}

src/java/pljava/org/postgresql/pljava/jdbc/ClobValue.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.io.Writer;
1717
import java.sql.Clob;
1818
import java.sql.SQLException;
19+
import java.sql.SQLFeatureNotSupportedException;
1920

2021
/**
2122
* @author Thomas Hallgren
@@ -228,4 +229,21 @@ public void truncate(long len)
228229
{
229230
throw new UnsupportedOperationException();
230231
}
232+
233+
// Start of Java 6 stubs
234+
235+
public Reader getCharacterStream(long pos,long length)
236+
throws SQLException
237+
{
238+
throw new SQLFeatureNotSupportedException();
239+
}
240+
241+
public void free()
242+
throws SQLException
243+
{
244+
throw new SQLFeatureNotSupportedException();
245+
}
246+
247+
// End of Java 6 stubs
248+
231249
}

src/java/pljava/org/postgresql/pljava/jdbc/ResultSetBase.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
package org.postgresql.pljava.jdbc;
88

9+
import java.sql.ResultSet;
910
import java.sql.SQLException;
1011

1112
/**
@@ -152,6 +153,27 @@ public void setFetchDirection(int direction)
152153
throw new UnsupportedFeatureException("Non forward fetch direction");
153154
}
154155

156+
// Start of Java 6 stubs
157+
158+
public boolean isClosed()
159+
throws SQLException
160+
{
161+
return m_row == -1;
162+
}
163+
164+
/**
165+
* Returns {@link ResultSet#CLOSE_CURSORS_AT_COMMIT}. Cursors are actually
166+
* closed when a function returns to SQL.
167+
*/
168+
public int getHoldability()
169+
throws SQLException
170+
{
171+
return ResultSet.CLOSE_CURSORS_AT_COMMIT;
172+
}
173+
174+
175+
// End of Java 6 stubs
176+
155177
public void setFetchSize(int fetchSize)
156178
throws SQLException
157179
{

src/java/pljava/org/postgresql/pljava/jdbc/SPIDatabaseMetaData.java

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
import java.sql.DatabaseMetaData;
88
import java.sql.PreparedStatement;
99
import java.sql.ResultSet;
10+
import java.sql.RowIdLifetime;
1011
import java.sql.SQLException;
12+
import java.sql.SQLFeatureNotSupportedException;
1113
import java.sql.Statement;
1214
import java.util.ArrayList;
1315
import java.util.HashMap;
@@ -3448,4 +3450,67 @@ private ResultSet createSyntheticResultSet(ResultSetField[] f, ArrayList tuples)
34483450
{
34493451
return new SyntheticResultSet(f, tuples);
34503452
}
3453+
3454+
// Start of Java 6 stubs
3455+
3456+
public ResultSet getFunctionColumns(String catalog,
3457+
String schemaPattern,
3458+
String functionNamePattern,
3459+
String columnNamePattern)
3460+
throws SQLException
3461+
{
3462+
throw new SQLFeatureNotSupportedException();
3463+
}
3464+
3465+
public ResultSet getFunctions(String catalog,
3466+
String schemaPattern,
3467+
String functionNamePattern)
3468+
throws SQLException
3469+
{
3470+
throw new SQLFeatureNotSupportedException();
3471+
}
3472+
3473+
public ResultSet getClientInfoProperties()
3474+
throws SQLException
3475+
{
3476+
throw new SQLFeatureNotSupportedException();
3477+
}
3478+
3479+
public boolean autoCommitFailureClosesAllResultSets()
3480+
throws SQLException
3481+
{
3482+
throw new SQLFeatureNotSupportedException();
3483+
}
3484+
3485+
public boolean supportsStoredFunctionsUsingCallSyntax()
3486+
throws SQLException
3487+
{
3488+
throw new SQLFeatureNotSupportedException();
3489+
}
3490+
3491+
public ResultSet getSchemas(String catalog,
3492+
String schemaPattern)
3493+
throws SQLException
3494+
{
3495+
throw new SQLFeatureNotSupportedException();
3496+
}
3497+
3498+
public RowIdLifetime getRowIdLifetime()
3499+
throws SQLException
3500+
{
3501+
throw new SQLFeatureNotSupportedException();
3502+
}
3503+
public boolean isWrapperFor(Class<?> c)
3504+
throws SQLException
3505+
{
3506+
throw new SQLFeatureNotSupportedException();
3507+
}
3508+
3509+
public <T> T unwrap(java.lang.Class<T> T)
3510+
throws SQLException
3511+
{
3512+
throw new SQLFeatureNotSupportedException();
3513+
}
3514+
3515+
// End of Java 6 stubs
34513516
}

src/java/pljava/org/postgresql/pljava/jdbc/SPIParameterMetaData.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import java.sql.ParameterMetaData;
1010
import java.sql.SQLException;
11+
import java.sql.SQLFeatureNotSupportedException;
1112

1213
/**
1314
*
@@ -90,4 +91,16 @@ public int getParameterMode(int paramIndex) throws SQLException
9091
throw new SQLException("Parameter index out of range");
9192
return parameterModeIn;
9293
}
94+
95+
public boolean isWrapperFor(Class<?> c)
96+
throws SQLException
97+
{
98+
throw new SQLFeatureNotSupportedException();
99+
}
100+
101+
public <T> T unwrap(Class<T> iface)
102+
throws SQLException
103+
{
104+
throw new SQLFeatureNotSupportedException();
105+
}
93106
}

src/java/pljava/org/postgresql/pljava/jdbc/SPIPreparedStatement.java

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@
1616
import java.sql.Blob;
1717
import java.sql.Clob;
1818
import java.sql.Date;
19+
import java.sql.NClob;
1920
import java.sql.ParameterMetaData;
2021
import java.sql.PreparedStatement;
2122
import java.sql.Ref;
2223
import java.sql.ResultSet;
2324
import java.sql.ResultSetMetaData;
25+
import java.sql.RowId;
2426
import java.sql.SQLException;
27+
import java.sql.SQLFeatureNotSupportedException;
2528
import java.sql.Time;
2629
import java.sql.Timestamp;
2730
import java.sql.Types;
31+
import java.sql.SQLXML;
2832
import java.util.Arrays;
2933
import java.util.Calendar;
3034

@@ -422,4 +426,131 @@ protected int executeBatchEntry(Object batchEntry)
422426
}
423427
return ret;
424428
}
429+
430+
// Start of Java 6 stubs
431+
432+
public void setNClob(int parameterIndex,
433+
Reader reader)
434+
throws SQLException
435+
{
436+
throw new SQLFeatureNotSupportedException();
437+
}
438+
public void setNClob(int parameterIndex,
439+
NClob value)
440+
throws SQLException
441+
{
442+
throw new SQLFeatureNotSupportedException();
443+
}
444+
public void setNClob(int parameterIndex,
445+
Reader reader,long length)
446+
throws SQLException
447+
{
448+
throw new SQLFeatureNotSupportedException();
449+
}
450+
451+
public void setBlob(int parameterIndex,
452+
InputStream inputStream)
453+
throws SQLException
454+
{
455+
throw new SQLFeatureNotSupportedException();
456+
}
457+
public void setBlob(int parameterIndex,
458+
InputStream inputStream,long length)
459+
throws SQLException
460+
{
461+
throw new SQLFeatureNotSupportedException();
462+
}
463+
464+
public void setClob(int parameterIndex,
465+
Reader reader)
466+
throws SQLException
467+
{
468+
throw new SQLFeatureNotSupportedException();
469+
}
470+
public void setClob(int parameterIndex,
471+
Reader reader,long length)
472+
throws SQLException
473+
{
474+
throw new SQLFeatureNotSupportedException();
475+
}
476+
477+
public void setNCharacterStream(int parameterIndex,
478+
Reader value)
479+
throws SQLException
480+
{
481+
throw new SQLFeatureNotSupportedException();
482+
}
483+
public void setNCharacterStream(int parameterIndex,
484+
Reader value,long length)
485+
throws SQLException
486+
{
487+
throw new SQLFeatureNotSupportedException();
488+
}
489+
490+
public void setCharacterStream(int parameterIndex,
491+
Reader reader)
492+
throws SQLException
493+
{
494+
throw new SQLFeatureNotSupportedException();
495+
}
496+
497+
public void setCharacterStream(int parameterIndex,
498+
Reader reader,long lenght)
499+
throws SQLException
500+
{
501+
throw new SQLFeatureNotSupportedException();
502+
}
503+
504+
public void setBinaryStream(int parameterIndex,
505+
InputStream x)
506+
throws SQLException
507+
{
508+
throw new SQLFeatureNotSupportedException();
509+
}
510+
public void setBinaryStream(int parameterIndex,
511+
InputStream x,long length)
512+
throws SQLException
513+
{
514+
throw new SQLFeatureNotSupportedException();
515+
}
516+
517+
public void setAsciiStream(int parameterIndex,
518+
InputStream x)
519+
throws SQLException
520+
{
521+
throw new SQLFeatureNotSupportedException();
522+
}
523+
524+
public void setAsciiStream(int parameterIndex,
525+
InputStream x,long length)
526+
throws SQLException
527+
{
528+
throw new SQLFeatureNotSupportedException();
529+
}
530+
531+
public void setSQLXML(int parameterIndex,
532+
SQLXML xmlObject)
533+
throws SQLException
534+
{
535+
throw new SQLFeatureNotSupportedException();
536+
}
537+
538+
539+
public void setNString(int parameterIndex,
540+
String value)
541+
throws SQLException
542+
{
543+
throw new SQLFeatureNotSupportedException();
544+
}
545+
546+
public void setRowId(int parameterIndex,
547+
RowId x)
548+
throws SQLException
549+
{
550+
throw new SQLFeatureNotSupportedException();
551+
}
552+
553+
554+
555+
// End of Java 6 stubs
425556
}

src/java/pljava/org/postgresql/pljava/jdbc/SPIResultSetMetaData.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
package org.postgresql.pljava.jdbc;
99

1010
import java.sql.SQLException;
11+
import java.sql.SQLFeatureNotSupportedException;
1112

1213
import org.postgresql.pljava.internal.Oid;
1314
import org.postgresql.pljava.internal.TupleDesc;
@@ -132,4 +133,23 @@ protected final int getFieldLength(int column) throws SQLException
132133
{
133134
return 0;
134135
}
136+
137+
// Start of Java 6 stubs
138+
139+
public boolean isWrapperFor(Class<?> iface)
140+
throws SQLException
141+
{
142+
throw new SQLFeatureNotSupportedException();
143+
}
144+
145+
public <T> T unwrap(Class<T> iface)
146+
throws SQLException
147+
{
148+
throw new SQLFeatureNotSupportedException();
149+
}
150+
151+
152+
// End of Java 6 stubs
153+
154+
135155
}

0 commit comments

Comments
 (0)