jxDBCon 0.9z

org.sourceforge.jxdbcon
Class AbstractPreparedStatement

java.lang.Object
  |
  +--org.sourceforge.jxdbcon.AbstractStatement
        |
        +--org.sourceforge.jxdbcon.AbstractPreparedStatement
All Implemented Interfaces:
PreparedStatement, Statement
Direct Known Subclasses:
AbstractCallableStatement, PGPreparedStatement

public abstract class AbstractPreparedStatement
extends AbstractStatement
implements PreparedStatement

AbstractPreparedStatement implements generics of the PreparedStatement interface. An overriding class has to initialize the paramTypes/Context. The setter functions implemented here delegate to their corresponding methods in AbstractType. TODO:

Version:
$Revision: 1.9 $, $Date: 2002/03/16 01:26:07 $
Author:
Keve Müller

Field Summary
protected  Object paramBuf
          The buffer to store the parameters in.
protected  ConversionContext paramContext
          The Context for converting to/form parameters.
private  BitSet paramSet
          A bitset that stores which parameters have been set.
protected  AbstractType[] paramTypes
          The parameter types.
 
Fields inherited from class org.sourceforge.jxdbcon.AbstractStatement
batch, conn, cursorName, escapeProcessing, fetchDirection, fetchSize, maxFieldSize, maxRows, queryTimeout, warnings
 
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
protected AbstractPreparedStatement(AbstractConnection conn, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
 
Method Summary
 void addBatch()
           
 void clearParameters()
           
 boolean execute()
          Execute the statement.
 ResultSet executeQuery()
           
 int executeUpdate()
           
 ParameterMetaData getParameterMetaData()
           
 void setArray(int parameterIndex, Array val)
           
 void setAsciiStream(int parameterIndex, InputStream val, int length)
           
 void setBigDecimal(int parameterIndex, BigDecimal val)
           
 void setBinaryStream(int parameterIndex, InputStream val, int length)
           
 void setBlob(int parameterIndex, Blob val)
           
 void setBoolean(int parameterIndex, boolean val)
           
 void setByte(int parameterIndex, byte val)
           
 void setBytes(int parameterIndex, byte[] val)
           
 void setCharacterStream(int parameterIndex, Reader val, int length)
           
 void setClob(int parameterIndex, Clob val)
           
 void setDate(int parameterIndex, Date val)
           
 void setDate(int parameterIndex, Date val, Calendar cal)
           
 void setDouble(int parameterIndex, double val)
           
 void setFloat(int parameterIndex, float val)
           
 void setInt(int parameterIndex, int val)
           
 void setLong(int parameterIndex, long val)
           
 void setNull(int parameterIndex, int sqlType)
           
 void setNull(int parameterIndex, int sqlType, String typeName)
           
 void setObject(int parameterIndex, Object val)
           
 void setObject(int parameterIndex, Object val, int targetSqlType)
           
 void setObject(int parameterIndex, Object val, int targetSqlType, int scale)
           
 void setRef(int parameterIndex, Ref val)
           
 void setShort(int parameterIndex, short val)
           
 void setString(int parameterIndex, String val)
           
 void setTime(int parameterIndex, Time val)
           
 void setTime(int parameterIndex, Time val, Calendar cal)
           
 void setTimestamp(int parameterIndex, Timestamp val)
           
 void setTimestamp(int parameterIndex, Timestamp val, Calendar cal)
           
 void setURL(int parameterIndex, URL val)
           
 
Methods inherited from class org.sourceforge.jxdbcon.AbstractStatement
addBatch, cancel, clearBatch, clearWarnings, close, execute, execute, execute, executeBatch, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, finalize, getConnection, getCursorName, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setQueryTimeout
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.PreparedStatement
getMetaData, setUnicodeStream
 
Methods inherited from interface java.sql.Statement
addBatch, cancel, clearBatch, clearWarnings, close, execute, 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
 

Field Detail

paramBuf

protected Object paramBuf
The buffer to store the parameters in.


paramContext

protected ConversionContext paramContext
The Context for converting to/form parameters.


paramSet

private BitSet paramSet
A bitset that stores which parameters have been set.


paramTypes

protected AbstractType[] paramTypes
The parameter types.

Constructor Detail

AbstractPreparedStatement

protected AbstractPreparedStatement(AbstractConnection conn,
                                    int resultSetType,
                                    int resultSetConcurrency,
                                    int resultSetHoldability)
                             throws SQLException
Method Detail

addBatch

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

clearParameters

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

execute

public boolean execute()
                throws SQLException
Execute the statement. This method checks whether all parameters are set. Any overriding class should run this first and then do whatever is needed to execute the query.

Specified by:
execute in interface PreparedStatement
SQLException

executeQuery

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

executeUpdate

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

getParameterMetaData

public ParameterMetaData getParameterMetaData()
                                       throws SQLException
Specified by:
getParameterMetaData in interface PreparedStatement
SQLException

setArray

public final void setArray(int parameterIndex,
                           Array val)
                    throws SQLException
Specified by:
setArray in interface PreparedStatement
SQLException

setAsciiStream

public final void setAsciiStream(int parameterIndex,
                                 InputStream val,
                                 int length)
                          throws SQLException
Specified by:
setAsciiStream in interface PreparedStatement
SQLException

setBigDecimal

public final void setBigDecimal(int parameterIndex,
                                BigDecimal val)
                         throws SQLException
Specified by:
setBigDecimal in interface PreparedStatement
SQLException

setBinaryStream

public final void setBinaryStream(int parameterIndex,
                                  InputStream val,
                                  int length)
                           throws SQLException
Specified by:
setBinaryStream in interface PreparedStatement
SQLException

setBlob

public final void setBlob(int parameterIndex,
                          Blob val)
                   throws SQLException
Specified by:
setBlob in interface PreparedStatement
SQLException

setBoolean

public final void setBoolean(int parameterIndex,
                             boolean val)
                      throws SQLException
Specified by:
setBoolean in interface PreparedStatement
SQLException

setByte

public final void setByte(int parameterIndex,
                          byte val)
                   throws SQLException
Specified by:
setByte in interface PreparedStatement
SQLException

setBytes

public final void setBytes(int parameterIndex,
                           byte[] val)
                    throws SQLException
Specified by:
setBytes in interface PreparedStatement
SQLException

setCharacterStream

public final void setCharacterStream(int parameterIndex,
                                     Reader val,
                                     int length)
                              throws SQLException
Specified by:
setCharacterStream in interface PreparedStatement
SQLException

setClob

public final void setClob(int parameterIndex,
                          Clob val)
                   throws SQLException
Specified by:
setClob in interface PreparedStatement
SQLException

setDate

public final void setDate(int parameterIndex,
                          Date val)
                   throws SQLException
Specified by:
setDate in interface PreparedStatement
SQLException

setDate

public final void setDate(int parameterIndex,
                          Date val,
                          Calendar cal)
                   throws SQLException
Specified by:
setDate in interface PreparedStatement
SQLException

setDouble

public final void setDouble(int parameterIndex,
                            double val)
                     throws SQLException
Specified by:
setDouble in interface PreparedStatement
SQLException

setFloat

public final void setFloat(int parameterIndex,
                           float val)
                    throws SQLException
Specified by:
setFloat in interface PreparedStatement
SQLException

setInt

public final void setInt(int parameterIndex,
                         int val)
                  throws SQLException
Specified by:
setInt in interface PreparedStatement
SQLException

setLong

public final void setLong(int parameterIndex,
                          long val)
                   throws SQLException
Specified by:
setLong in interface PreparedStatement
SQLException

setNull

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

setNull

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

setObject

public final void setObject(int parameterIndex,
                            Object val)
                     throws SQLException
Specified by:
setObject in interface PreparedStatement
SQLException

setObject

public final void setObject(int parameterIndex,
                            Object val,
                            int targetSqlType)
                     throws SQLException
Specified by:
setObject in interface PreparedStatement
SQLException

setObject

public final void setObject(int parameterIndex,
                            Object val,
                            int targetSqlType,
                            int scale)
                     throws SQLException
Specified by:
setObject in interface PreparedStatement
SQLException

setRef

public final void setRef(int parameterIndex,
                         Ref val)
                  throws SQLException
Specified by:
setRef in interface PreparedStatement
SQLException

setShort

public final void setShort(int parameterIndex,
                           short val)
                    throws SQLException
Specified by:
setShort in interface PreparedStatement
SQLException

setString

public final void setString(int parameterIndex,
                            String val)
                     throws SQLException
Specified by:
setString in interface PreparedStatement
SQLException

setTime

public final void setTime(int parameterIndex,
                          Time val)
                   throws SQLException
Specified by:
setTime in interface PreparedStatement
SQLException

setTime

public final void setTime(int parameterIndex,
                          Time val,
                          Calendar cal)
                   throws SQLException
Specified by:
setTime in interface PreparedStatement
SQLException

setTimestamp

public final void setTimestamp(int parameterIndex,
                               Timestamp val)
                        throws SQLException
Specified by:
setTimestamp in interface PreparedStatement
SQLException

setTimestamp

public final void setTimestamp(int parameterIndex,
                               Timestamp val,
                               Calendar cal)
                        throws SQLException
Specified by:
setTimestamp in interface PreparedStatement
SQLException

setURL

public final void setURL(int parameterIndex,
                         URL val)
                  throws SQLException
Specified by:
setURL in interface PreparedStatement
SQLException

jxDBCon 0.9z

Copyright © 2001,2002 Keve Müller; see LICENSE file for details.