org.postgresql.pljava.jdbc
Class SPIPreparedStatement

java.lang.Object
  extended by org.postgresql.pljava.jdbc.SPIStatement
      extended by org.postgresql.pljava.jdbc.SPIPreparedStatement
All Implemented Interfaces:
PreparedStatement, Statement

public class SPIPreparedStatement
extends SPIStatement
implements PreparedStatement

Author:
Thomas Hallgren

Field Summary
 
Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
 
Constructor Summary
SPIPreparedStatement(SPIConnection conn, String statement, int paramCount)
           
 
Method Summary
 void addBatch()
           
 void addBatch(String statement)
          The prepared statement cannot have other statements added too it.
 void clearParameters()
           
 void close()
           
 boolean execute()
           
 boolean execute(String statement)
          The prepared statement cannot be used for executing oter statements.
protected  int executeBatchEntry(Object batchEntry)
           
 ResultSet executeQuery()
           
 int executeUpdate()
           
 ResultSetMetaData getMetaData()
          ResultSetMetaData is not yet supported.
 ParameterMetaData getParameterMetaData()
          Due to the design of the SPI_prepare, it is currently impossible to obtain the correct parameter meta data before all the parameters have been set, hence a ParameterMetaData obtained prior to setting the paramteres will have all parameters set to the default type Types.VARCHAR.
 void setArray(int columnIndex, Array value)
           
 void setAsciiStream(int columnIndex, InputStream value, int length)
           
 void setBigDecimal(int columnIndex, BigDecimal value)
           
 void setBinaryStream(int columnIndex, InputStream value, int length)
           
 void setBlob(int columnIndex, Blob value)
           
 void setBoolean(int columnIndex, boolean value)
           
 void setByte(int columnIndex, byte value)
           
 void setBytes(int columnIndex, byte[] value)
           
 void setCharacterStream(int columnIndex, Reader value, int length)
           
 void setClob(int columnIndex, Clob value)
           
 void setDate(int columnIndex, Date value)
           
 void setDate(int columnIndex, Date value, Calendar cal)
           
 void setDouble(int columnIndex, double value)
           
 void setFloat(int columnIndex, float value)
           
 void setInt(int columnIndex, int value)
           
 void setLong(int columnIndex, long value)
           
 void setNull(int columnIndex, int sqlType)
           
 void setNull(int columnIndex, int sqlType, String typeName)
           
 void setObject(int columnIndex, Object value)
           
 void setObject(int columnIndex, Object value, int sqlType)
           
 void setObject(int columnIndex, Object value, int sqlType, int scale)
           
 void setRef(int columnIndex, Ref value)
           
 void setShort(int columnIndex, short value)
           
 void setString(int columnIndex, String value)
           
 void setTime(int columnIndex, Time value)
           
 void setTime(int columnIndex, Time value, Calendar cal)
           
 void setTimestamp(int columnIndex, Timestamp value)
           
 void setTimestamp(int columnIndex, Timestamp value, Calendar cal)
           
 void setUnicodeStream(int columnIndex, InputStream value, int arg2)
          Deprecated.  
 void setURL(int columnIndex, URL value)
           
 String toString()
           
 
Methods inherited from class org.postgresql.pljava.jdbc.SPIStatement
cancel, clearBatch, clearWarnings, execute, execute, execute, executeBatch, executePlan, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, internalAddBatch, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setQueryTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.sql.Statement
cancel, clearBatch, clearWarnings, execute, execute, execute, executeBatch, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setQueryTimeout
 

Constructor Detail

SPIPreparedStatement

public SPIPreparedStatement(SPIConnection conn,
                            String statement,
                            int paramCount)
Method Detail

close

public void close()
           throws SQLException
Specified by:
close in interface Statement
Overrides:
close in class SPIStatement
Throws:
SQLException

executeQuery

public ResultSet executeQuery()
                       throws SQLException
Specified by:
executeQuery in interface PreparedStatement
Throws:
SQLException

executeUpdate

public int executeUpdate()
                  throws SQLException
Specified by:
executeUpdate in interface PreparedStatement
Throws:
SQLException

setNull

public void setNull(int columnIndex,
                    int sqlType)
             throws SQLException
Specified by:
setNull in interface PreparedStatement
Throws:
SQLException

setBoolean

public void setBoolean(int columnIndex,
                       boolean value)
                throws SQLException
Specified by:
setBoolean in interface PreparedStatement
Throws:
SQLException

setByte

public void setByte(int columnIndex,
                    byte value)
             throws SQLException
Specified by:
setByte in interface PreparedStatement
Throws:
SQLException

setShort

public void setShort(int columnIndex,
                     short value)
              throws SQLException
Specified by:
setShort in interface PreparedStatement
Throws:
SQLException

setInt

public void setInt(int columnIndex,
                   int value)
            throws SQLException
Specified by:
setInt in interface PreparedStatement
Throws:
SQLException

setLong

public void setLong(int columnIndex,
                    long value)
             throws SQLException
Specified by:
setLong in interface PreparedStatement
Throws:
SQLException

setFloat

public void setFloat(int columnIndex,
                     float value)
              throws SQLException
Specified by:
setFloat in interface PreparedStatement
Throws:
SQLException

setDouble

public void setDouble(int columnIndex,
                      double value)
               throws SQLException
Specified by:
setDouble in interface PreparedStatement
Throws:
SQLException

setBigDecimal

public void setBigDecimal(int columnIndex,
                          BigDecimal value)
                   throws SQLException
Specified by:
setBigDecimal in interface PreparedStatement
Throws:
SQLException

setString

public void setString(int columnIndex,
                      String value)
               throws SQLException
Specified by:
setString in interface PreparedStatement
Throws:
SQLException

setBytes

public void setBytes(int columnIndex,
                     byte[] value)
              throws SQLException
Specified by:
setBytes in interface PreparedStatement
Throws:
SQLException

setDate

public void setDate(int columnIndex,
                    Date value)
             throws SQLException
Specified by:
setDate in interface PreparedStatement
Throws:
SQLException

setTime

public void setTime(int columnIndex,
                    Time value)
             throws SQLException
Specified by:
setTime in interface PreparedStatement
Throws:
SQLException

setTimestamp

public void setTimestamp(int columnIndex,
                         Timestamp value)
                  throws SQLException
Specified by:
setTimestamp in interface PreparedStatement
Throws:
SQLException

setAsciiStream

public void setAsciiStream(int columnIndex,
                           InputStream value,
                           int length)
                    throws SQLException
Specified by:
setAsciiStream in interface PreparedStatement
Throws:
SQLException

setUnicodeStream

public void setUnicodeStream(int columnIndex,
                             InputStream value,
                             int arg2)
                      throws SQLException
Deprecated. 

Specified by:
setUnicodeStream in interface PreparedStatement
Throws:
SQLException

setBinaryStream

public void setBinaryStream(int columnIndex,
                            InputStream value,
                            int length)
                     throws SQLException
Specified by:
setBinaryStream in interface PreparedStatement
Throws:
SQLException

clearParameters

public void clearParameters()
                     throws SQLException
Specified by:
clearParameters in interface PreparedStatement
Throws:
SQLException

setObject

public void setObject(int columnIndex,
                      Object value,
                      int sqlType,
                      int scale)
               throws SQLException
Specified by:
setObject in interface PreparedStatement
Throws:
SQLException

setObject

public void setObject(int columnIndex,
                      Object value,
                      int sqlType)
               throws SQLException
Specified by:
setObject in interface PreparedStatement
Throws:
SQLException

setObject

public void setObject(int columnIndex,
                      Object value)
               throws SQLException
Specified by:
setObject in interface PreparedStatement
Throws:
SQLException

execute

public boolean execute()
                throws SQLException
Specified by:
execute in interface PreparedStatement
Throws:
SQLException

execute

public boolean execute(String statement)
                throws SQLException
The prepared statement cannot be used for executing oter statements.

Specified by:
execute in interface Statement
Overrides:
execute in class SPIStatement
Throws:
SQLException - indicating that this feature is not supported.

addBatch

public void addBatch()
              throws SQLException
Specified by:
addBatch in interface PreparedStatement
Throws:
SQLException

addBatch

public void addBatch(String statement)
              throws SQLException
The prepared statement cannot have other statements added too it.

Specified by:
addBatch in interface Statement
Overrides:
addBatch in class SPIStatement
Throws:
SQLException - indicating that this feature is not supported.

setCharacterStream

public void setCharacterStream(int columnIndex,
                               Reader value,
                               int length)
                        throws SQLException
Specified by:
setCharacterStream in interface PreparedStatement
Throws:
SQLException

setRef

public void setRef(int columnIndex,
                   Ref value)
            throws SQLException
Specified by:
setRef in interface PreparedStatement
Throws:
SQLException

setBlob

public void setBlob(int columnIndex,
                    Blob value)
             throws SQLException
Specified by:
setBlob in interface PreparedStatement
Throws:
SQLException

setClob

public void setClob(int columnIndex,
                    Clob value)
             throws SQLException
Specified by:
setClob in interface PreparedStatement
Throws:
SQLException

setArray

public void setArray(int columnIndex,
                     Array value)
              throws SQLException
Specified by:
setArray in interface PreparedStatement
Throws:
SQLException

getMetaData

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

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

setDate

public void setDate(int columnIndex,
                    Date value,
                    Calendar cal)
             throws SQLException
Specified by:
setDate in interface PreparedStatement
Throws:
SQLException

setTime

public void setTime(int columnIndex,
                    Time value,
                    Calendar cal)
             throws SQLException
Specified by:
setTime in interface PreparedStatement
Throws:
SQLException

setTimestamp

public void setTimestamp(int columnIndex,
                         Timestamp value,
                         Calendar cal)
                  throws SQLException
Specified by:
setTimestamp in interface PreparedStatement
Throws:
SQLException

setNull

public void setNull(int columnIndex,
                    int sqlType,
                    String typeName)
             throws SQLException
Specified by:
setNull in interface PreparedStatement
Throws:
SQLException

setURL

public void setURL(int columnIndex,
                   URL value)
            throws SQLException
Specified by:
setURL in interface PreparedStatement
Throws:
SQLException

toString

public String toString()
Overrides:
toString in class Object

getParameterMetaData

public ParameterMetaData getParameterMetaData()
                                       throws SQLException
Due to the design of the SPI_prepare, it is currently impossible to obtain the correct parameter meta data before all the parameters have been set, hence a ParameterMetaData obtained prior to setting the paramteres will have all parameters set to the default type Types.VARCHAR. Once the parameters have been set, a fair attempt is made to generate this object based on the supplied values.

Specified by:
getParameterMetaData in interface PreparedStatement
Returns:
The meta data for parameter values.
Throws:
SQLException

executeBatchEntry

protected int executeBatchEntry(Object batchEntry)
                         throws SQLException
Overrides:
executeBatchEntry in class SPIStatement
Throws:
SQLException