Skip to content

Commit

Permalink
Move project to Java 8, and add JDBC 4.2 stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperpedersen committed Jan 20, 2017
1 parent 396c8f7 commit 5d40235
Show file tree
Hide file tree
Showing 13 changed files with 497 additions and 11 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
@@ -1,10 +1,8 @@
sudo: required
language: java
jdk:
- oraclejdk7
- oraclejdk8
env:
- PGVERSION=9.1
- PGVERSION=9.2
- PGVERSION=9.3
- PGVERSION=9.4
Expand All @@ -14,7 +12,7 @@ script: mvn -e test
after_failure:
- ./.travis/print_surefire_reports
after_success:
- "test $TRAVIS_PULL_REQUEST == 'false' && test $TRAVIS_BRANCH == 'develop' && test $TRAVIS_JDK_VERSION == 'oraclejdk7' && test $PGVERSION == '9.5' && ./.travis/travis-maven-deploy"
- "test $TRAVIS_PULL_REQUEST == 'false' && test $TRAVIS_BRANCH == 'develop' && test $TRAVIS_JDK_VERSION == 'oraclejdk8' && test $PGVERSION == '9.5' && ./.travis/travis-maven-deploy"
cache:
directories:
- '$HOME/.m2/repository'
14 changes: 7 additions & 7 deletions pom.xml
Expand Up @@ -94,13 +94,13 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
64 changes: 64 additions & 0 deletions src/main/java/com/impossibl/postgres/jdbc/PGCallableStatement.java
Expand Up @@ -74,6 +74,7 @@
import java.sql.Ref;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLType;
import java.sql.SQLXML;
import java.sql.Time;
import java.sql.Timestamp;
Expand Down Expand Up @@ -1034,4 +1035,67 @@ public void setNClob(String parameterName, Reader reader) throws SQLException {
setNClob(findParameter(parameterName), reader);
}

/**
* {@inheritDoc}
*/
@Override
public void setObject(String parameterName, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
throw NOT_IMPLEMENTED;
}

/**
* {@inheritDoc}
*/
@Override
public void setObject(String parameterName, Object x, SQLType targetSqlType) throws SQLException {
throw NOT_IMPLEMENTED;
}

/**
* {@inheritDoc}
*/
@Override
public void registerOutParameter(int parameterIndex, SQLType sqlType) throws SQLException {
throw NOT_IMPLEMENTED;
}

/**
* {@inheritDoc}
*/
@Override
public void registerOutParameter(int parameterIndex, SQLType sqlType, int scale) throws SQLException {
throw NOT_IMPLEMENTED;
}

/**
* {@inheritDoc}
*/
@Override
public void registerOutParameter(int parameterIndex, SQLType sqlType, String typeName) throws SQLException {
throw NOT_IMPLEMENTED;
}

/**
* {@inheritDoc}
*/
@Override
public void registerOutParameter(String parameterName, SQLType sqlType) throws SQLException {
throw NOT_IMPLEMENTED;
}

/**
* {@inheritDoc}
*/
@Override
public void registerOutParameter(String parameterName, SQLType sqlType, int scale) throws SQLException {
throw NOT_IMPLEMENTED;
}

/**
* {@inheritDoc}
*/
@Override
public void registerOutParameter(String parameterName, SQLType sqlType, String typeName) throws SQLException {
throw NOT_IMPLEMENTED;
}
}
Expand Up @@ -41,6 +41,7 @@
import java.sql.Ref;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLType;
import java.sql.SQLXML;
import java.sql.Time;
import java.sql.Timestamp;
Expand Down Expand Up @@ -1649,6 +1650,118 @@ public boolean wasNull() throws SQLException {
}
}

/**
* {@inheritDoc}
*/
@Override
public void setObject(String parameterName, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
try {
delegator.setObject(parameterName, x, targetSqlType, scaleOrLength);
}
catch (SQLException se) {
owner.fireStatementError(this, se);
throw se;
}
}

/**
* {@inheritDoc}
*/
@Override
public void setObject(String parameterName, Object x, SQLType targetSqlType) throws SQLException {
try {
delegator.setObject(parameterName, x, targetSqlType);
}
catch (SQLException se) {
owner.fireStatementError(this, se);
throw se;
}
}

/**
* {@inheritDoc}
*/
@Override
public void registerOutParameter(int parameterIndex, SQLType sqlType) throws SQLException {
try {
delegator.registerOutParameter(parameterIndex, sqlType);
}
catch (SQLException se) {
owner.fireStatementError(this, se);
throw se;
}
}

/**
* {@inheritDoc}
*/
@Override
public void registerOutParameter(int parameterIndex, SQLType sqlType, int scale) throws SQLException {
try {
delegator.registerOutParameter(parameterIndex, sqlType, scale);
}
catch (SQLException se) {
owner.fireStatementError(this, se);
throw se;
}
}

/**
* {@inheritDoc}
*/
@Override
public void registerOutParameter(int parameterIndex, SQLType sqlType, String typeName) throws SQLException {
try {
delegator.registerOutParameter(parameterIndex, sqlType, typeName);
}
catch (SQLException se) {
owner.fireStatementError(this, se);
throw se;
}
}

/**
* {@inheritDoc}
*/
@Override
public void registerOutParameter(String parameterName, SQLType sqlType) throws SQLException {
try {
delegator.registerOutParameter(parameterName, sqlType);
}
catch (SQLException se) {
owner.fireStatementError(this, se);
throw se;
}
}

/**
* {@inheritDoc}
*/
@Override
public void registerOutParameter(String parameterName, SQLType sqlType, int scale) throws SQLException {
try {
delegator.registerOutParameter(parameterName, sqlType, scale);
}
catch (SQLException se) {
owner.fireStatementError(this, se);
throw se;
}
}

/**
* {@inheritDoc}
*/
@Override
public void registerOutParameter(String parameterName, SQLType sqlType, String typeName) throws SQLException {
try {
delegator.registerOutParameter(parameterName, sqlType, typeName);
}
catch (SQLException se) {
owner.fireStatementError(this, se);
throw se;
}
}

/**
* {@inheritDoc}
*/
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/impossibl/postgres/jdbc/PGDatabaseMetaData.java
Expand Up @@ -2711,4 +2711,19 @@ public boolean generatedKeyAlwaysReturned() throws SQLException {
return false;
}

/**
* {@inheritDoc}
*/
@Override
public long getMaxLogicalLobSize() throws SQLException {
throw NOT_IMPLEMENTED;
}

/**
* {@inheritDoc}
*/
@Override
public boolean supportsRefCursors() throws SQLException {
throw NOT_IMPLEMENTED;
}
}
8 changes: 7 additions & 1 deletion src/main/java/com/impossibl/postgres/jdbc/PGDriver.java
Expand Up @@ -34,6 +34,7 @@
import com.impossibl.postgres.system.Version;

import java.sql.Driver;
import java.sql.DriverAction;
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
Expand All @@ -49,7 +50,7 @@
* @author <a href="mailto:kdubb@me.com">Kevin Wooten</a>
* @author <a href="mailto:jesper.pedersen@redhat.com">Jesper Pedersen</a>
*/
public class PGDriver implements Driver {
public class PGDriver implements Driver, DriverAction {
/** The version of the driver */
public static final Version VERSION = Version.get(0, 1, 0);

Expand Down Expand Up @@ -122,6 +123,11 @@ public Logger getParentLogger() throws SQLFeatureNotSupportedException {
return Logger.getLogger(Context.class.getPackage().getName());
}

@Override
public void deregister() {
cleanup();
}

public static void cleanup() {

if (registered != null) {
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/com/impossibl/postgres/jdbc/PGPreparedStatement.java
Expand Up @@ -73,6 +73,7 @@
import java.sql.ResultSetMetaData;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLType;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Statement;
Expand Down Expand Up @@ -951,4 +952,27 @@ public void addBatch(String sql) throws SQLException {
throw NOT_ALLOWED_ON_PREP_STMT;
}

/**
* {@inheritDoc}
*/
@Override
public void setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
throw NOT_IMPLEMENTED;
}

/**
* {@inheritDoc}
*/
@Override
public void setObject(int parameterIndex, Object x, SQLType targetSqlType) throws SQLException {
throw NOT_IMPLEMENTED;
}

/**
* {@inheritDoc}
*/
@Override
public long executeLargeUpdate() throws SQLException {
throw NOT_IMPLEMENTED;
}
}
Expand Up @@ -44,6 +44,7 @@
import java.sql.ResultSetMetaData;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLType;
import java.sql.SQLXML;
import java.sql.Time;
import java.sql.Timestamp;
Expand Down Expand Up @@ -854,6 +855,49 @@ public void setURL(int parameterIndex, URL x) throws SQLException {
}
}


/**
* {@inheritDoc}
*/
@Override
public void setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
try {
delegator.setObject(parameterIndex, x, targetSqlType, scaleOrLength);
}
catch (SQLException se) {
owner.fireStatementError(this, se);
throw se;
}
}

/**
* {@inheritDoc}
*/
@Override
public void setObject(int parameterIndex, Object x, SQLType targetSqlType) throws SQLException {
try {
delegator.setObject(parameterIndex, x, targetSqlType);
}
catch (SQLException se) {
owner.fireStatementError(this, se);
throw se;
}
}

/**
* {@inheritDoc}
*/
@Override
public long executeLargeUpdate() throws SQLException {
try {
return delegator.executeLargeUpdate();
}
catch (SQLException se) {
owner.fireStatementError(this, se);
throw se;
}
}

/**
* {@inheritDoc}
*/
Expand Down

0 comments on commit 5d40235

Please sign in to comment.