org.postgresql.pljava.jdbc
Class SPIConnection

java.lang.Object
  extended by org.postgresql.pljava.jdbc.SPIConnection
All Implemented Interfaces:
Connection

public class SPIConnection
extends Object
implements Connection

Author:
Thomas Hallgren

Field Summary
static int[] JDBC_TYPE_NUMBERS
           
static String[] JDBC3_TYPE_NAMES
           
 
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Constructor Summary
SPIConnection()
           
 
Method Summary
 void clearWarnings()
          Warnings are not yet supported.
 void close()
          This is a no-op.
 void commit()
          It's not legal to do a commit within a call from SQL.
 Statement createStatement()
          Creates a new instance of SPIStatement.
 Statement createStatement(int resultSetType, int resultSetConcurrency)
          Creates a new instance of SPIStatement.
 Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
          Creates a new instance of SPIStatement.
 boolean getAutoCommit()
          It is assumed that an SPI call is under transaction control.
 String getCatalog()
          Returns null.
static Connection getDefault()
          Returns a default connection instance.
 int getHoldability()
          Returns ResultSet.CLOSE_CURSORS_AT_COMMIT.
 DatabaseMetaData getMetaData()
          DatabaseMetaData is not yet supported.
 String getPGType(Oid oid)
           
 int getSQLType(Oid oid)
           
 int getSQLType(String pgTypeName)
           
 int getTransactionIsolation()
          Returns Connection.TRANSACTION_READ_COMMITTED.
 Map getTypeMap()
          Returns null.
 int[] getVersionNumber()
           
 SQLWarning getWarnings()
          Warnings are not yet supported.
 boolean isClosed()
          Will always return false.
 boolean isReadOnly()
          Returns false.
 String nativeSQL(String sql)
          Parse the JDBC SQL into PostgreSQL.
 String nativeSQL(String sql, int[] paramCountRet)
           
 CallableStatement prepareCall(String sql)
          Procedure calls are not yet implemented.
 CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency)
          Procedure calls are not yet implemented.
 CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
          Procedure calls are not yet implemented.
 PreparedStatement prepareStatement(String sql)
          Creates a new instance of SPIPreparedStatement.
 PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
          Return of auto generated keys is not yet supported.
 PreparedStatement prepareStatement(String sql, int[] columnIndexes)
          Return of auto generated keys is not yet supported.
 PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
          Creates a new instance of SPIPreparedStatement.
 PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
          Creates a new instance of SPIPreparedStatement.
 PreparedStatement prepareStatement(String sql, String[] columnNames)
          Return of auto generated keys is not yet supported.
 void releaseSavepoint(Savepoint savepoint)
           
 void rollback()
          It's not legal to do a rollback within a call from SQL.
 void rollback(Savepoint savepoint)
           
 void setAutoCommit(boolean autoCommit)
          It is assumed that an SPI call is under transaction control.
 void setCatalog(String catalog)
          The catalog name cannot be set.
 void setHoldability(int holdability)
          Change of holdability is not supported.
 void setReadOnly(boolean readOnly)
          It is assumed that an inserts and updates can be performed using and SPIConnection.
 Savepoint setSavepoint()
           
 Savepoint setSavepoint(String name)
           
 void setTransactionIsolation(int level)
          Change of transaction isolation level is not supported.
 void setTypeMap(Map map)
          Type map is not yet implemented.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JDBC3_TYPE_NAMES

public static final String[] JDBC3_TYPE_NAMES

JDBC_TYPE_NUMBERS

public static final int[] JDBC_TYPE_NUMBERS
Constructor Detail

SPIConnection

public SPIConnection()
Method Detail

getDefault

public static Connection getDefault()
                             throws SQLException
Returns a default connection instance. It is the callers responsability to close this instance.

Throws:
SQLException

getHoldability

public int getHoldability()
                   throws SQLException
Returns ResultSet.CLOSE_CURSORS_AT_COMMIT. Cursors are actually closed when a function returns to SQL.

Specified by:
getHoldability in interface Connection
Throws:
SQLException

getTransactionIsolation

public int getTransactionIsolation()
                            throws SQLException
Returns Connection.TRANSACTION_READ_COMMITTED.

Specified by:
getTransactionIsolation in interface Connection
Throws:
SQLException

clearWarnings

public void clearWarnings()
                   throws SQLException
Warnings are not yet supported.

Specified by:
clearWarnings in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

close

public void close()
           throws SQLException
This is a no-op. The default connection never closes.

Specified by:
close in interface Connection
Throws:
SQLException

commit

public void commit()
            throws SQLException
It's not legal to do a commit within a call from SQL.

Specified by:
commit in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

rollback

public void rollback()
              throws SQLException
It's not legal to do a rollback within a call from SQL.

Specified by:
rollback in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

getAutoCommit

public boolean getAutoCommit()
                      throws SQLException
It is assumed that an SPI call is under transaction control. This method will always return false.

Specified by:
getAutoCommit in interface Connection
Throws:
SQLException

isClosed

public boolean isClosed()
                 throws SQLException
Will always return false.

Specified by:
isClosed in interface Connection
Throws:
SQLException

isReadOnly

public boolean isReadOnly()
                   throws SQLException
Returns false. The SPIConnection is not real-only.

Specified by:
isReadOnly in interface Connection
Throws:
SQLException

setHoldability

public void setHoldability(int holdability)
                    throws SQLException
Change of holdability is not supported.

Specified by:
setHoldability in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

setTransactionIsolation

public void setTransactionIsolation(int level)
                             throws SQLException
Change of transaction isolation level is not supported.

Specified by:
setTransactionIsolation in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws SQLException
It is assumed that an SPI call is under transaction control. Changing that is not supported.

Specified by:
setAutoCommit in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

setReadOnly

public void setReadOnly(boolean readOnly)
                 throws SQLException
It is assumed that an inserts and updates can be performed using and SPIConnection. Changing that is not supported.

Specified by:
setReadOnly in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

getCatalog

public String getCatalog()
                  throws SQLException
Returns null.

Specified by:
getCatalog in interface Connection
Throws:
SQLException

setCatalog

public void setCatalog(String catalog)
                throws SQLException
The catalog name cannot be set.

Specified by:
setCatalog in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

getMetaData

public DatabaseMetaData getMetaData()
                             throws SQLException
DatabaseMetaData is not yet supported.

Specified by:
getMetaData in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

getWarnings

public SQLWarning getWarnings()
                       throws SQLException
Warnings are not yet supported.

Specified by:
getWarnings in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

releaseSavepoint

public void releaseSavepoint(Savepoint savepoint)
                      throws SQLException
Specified by:
releaseSavepoint in interface Connection
Throws:
SQLException

rollback

public void rollback(Savepoint savepoint)
              throws SQLException
Specified by:
rollback in interface Connection
Throws:
SQLException

createStatement

public Statement createStatement()
                          throws SQLException
Creates a new instance of SPIStatement.

Specified by:
createStatement in interface Connection
Throws:
SQLException

createStatement

public Statement createStatement(int resultSetType,
                                 int resultSetConcurrency)
                          throws SQLException
Creates a new instance of SPIStatement.

Specified by:
createStatement in interface Connection
Throws:
SQLException - if the resultSetType differs from ResultSet.TYPE_FORWARD_ONLY or if the resultSetConcurrencty differs from ResultSet.CONCUR_READ_ONLY.

createStatement

public Statement createStatement(int resultSetType,
                                 int resultSetConcurrency,
                                 int resultSetHoldability)
                          throws SQLException
Creates a new instance of SPIStatement.

Specified by:
createStatement in interface Connection
Throws:
SQLException - if the resultSetType differs from ResultSet.TYPE_FORWARD_ONLY, if the resultSetConcurrencty differs from ResultSet.CONCUR_READ_ONLY, or if the resultSetHoldability differs from ResultSet.CLOSE_CURSORS_AT_COMMIT.

getTypeMap

public Map getTypeMap()
               throws SQLException
Returns null. Type map is not yet imlemented.

Specified by:
getTypeMap in interface Connection
Throws:
SQLException

setTypeMap

public void setTypeMap(Map map)
                throws SQLException
Type map is not yet implemented.

Specified by:
setTypeMap in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

nativeSQL

public String nativeSQL(String sql)
                 throws SQLException
Parse the JDBC SQL into PostgreSQL.

Specified by:
nativeSQL in interface Connection
Throws:
SQLException

nativeSQL

public String nativeSQL(String sql,
                        int[] paramCountRet)

prepareCall

public CallableStatement prepareCall(String sql)
                              throws SQLException
Procedure calls are not yet implemented.

Specified by:
prepareCall in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

prepareCall

public CallableStatement prepareCall(String sql,
                                     int resultSetType,
                                     int resultSetConcurrency)
                              throws SQLException
Procedure calls are not yet implemented.

Specified by:
prepareCall in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

prepareCall

public CallableStatement prepareCall(String sql,
                                     int resultSetType,
                                     int resultSetConcurrency,
                                     int resultSetHoldability)
                              throws SQLException
Procedure calls are not yet implemented.

Specified by:
prepareCall in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

prepareStatement

public PreparedStatement prepareStatement(String sql)
                                   throws SQLException
Creates a new instance of SPIPreparedStatement.

Specified by:
prepareStatement in interface Connection
Throws:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int autoGeneratedKeys)
                                   throws SQLException
Return of auto generated keys is not yet supported.

Specified by:
prepareStatement in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int resultSetType,
                                          int resultSetConcurrency)
                                   throws SQLException
Creates a new instance of SPIPreparedStatement.

Specified by:
prepareStatement in interface Connection
Throws:
SQLException - if the resultSetType differs from ResultSet.TYPE_FORWARD_ONLY or if the resultSetConcurrencty differs from ResultSet.CONCUR_READ_ONLY.

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int resultSetType,
                                          int resultSetConcurrency,
                                          int resultSetHoldability)
                                   throws SQLException
Creates a new instance of SPIPreparedStatement.

Specified by:
prepareStatement in interface Connection
Throws:
SQLException - if the resultSetType differs from ResultSet.TYPE_FORWARD_ONLY, if the resultSetConcurrencty differs from ResultSet.CONCUR_READ_ONLY, or if the resultSetHoldability differs from ResultSet.CLOSE_CURSORS_AT_COMMIT.

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int[] columnIndexes)
                                   throws SQLException
Return of auto generated keys is not yet supported.

Specified by:
prepareStatement in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          String[] columnNames)
                                   throws SQLException
Return of auto generated keys is not yet supported.

Specified by:
prepareStatement in interface Connection
Throws:
SQLException - indicating that this feature is not supported.

setSavepoint

public Savepoint setSavepoint()
                       throws SQLException
Specified by:
setSavepoint in interface Connection
Throws:
SQLException

setSavepoint

public Savepoint setSavepoint(String name)
                       throws SQLException
Specified by:
setSavepoint in interface Connection
Throws:
SQLException

getVersionNumber

public int[] getVersionNumber()
                       throws SQLException
Throws:
SQLException

getSQLType

public int getSQLType(String pgTypeName)

getSQLType

public int getSQLType(Oid oid)
               throws SQLException
Throws:
SQLException

getPGType

public String getPGType(Oid oid)
                 throws SQLException
Throws:
SQLException