superwaba.ext.xplat.sql
Class PreparedStatement

java.lang.Object
  |
  +--superwaba.ext.xplat.sql.Statement
        |
        +--superwaba.ext.xplat.sql.PreparedStatement
Direct Known Subclasses:
Db2eStatement

public abstract class PreparedStatement
extends Statement

This interface provides a mechanism for executing pre-compiled statements. This provides greater efficiency when calling the same statement multiple times. Parameters are allowed in a statement, providings for maximum reusability.


Fields inherited from class superwaba.ext.xplat.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
 
Constructor Summary
PreparedStatement()
           
 
Method Summary
abstract  void addBatch()
          This method adds a set of parameters to the batch for JDBC 2.0.
abstract  void clearParameters()
          This method clears all of the input parameter that have been set on this statement.
abstract  boolean execute()
          This method executes a prepared SQL query.
abstract  ResultSet executeQuery()
          This method executes a prepared SQL query and returns its ResultSet.
abstract  int executeUpdate()
          This method executes an SQL INSERT, UPDATE or DELETE statement.
abstract  ResultSetMetaData getMetaData()
          This method returns meta data for the result set from this statement.
abstract  ParameterMetaData getParameterMetaData()
           
abstract  void setBlob(int i, Blob x)
          This method sets the specified parameter from the given Java Blob value.
abstract  void setBoolean(int parameterIndex, boolean x)
          This method sets the specified parameter from the given Java boolean value.
abstract  void setByte(int parameterIndex, byte x)
          This method sets the specified parameter from the given Java byte value.
abstract  void setBytes(int parameterIndex, byte[] x)
          This method sets the specified parameter from the given Java byte array value.
abstract  void setBytes(int parameterIndex, byte[] x, int start, int length)
          This method sets the specified parameter from the given Java byte array value.
abstract  void setDate(int parameterIndex, Date x)
          This method sets the specified parameter from the given Java java.sql.Date value.
abstract  void setDouble(int parameterIndex, double x)
          This method sets the specified parameter from the given Java double value.
abstract  void setFloat(int parameterIndex, float x)
          This method sets the specified parameter from the given Java float value.
abstract  void setInt(int parameterIndex, int x)
          This method sets the specified parameter from the given Java int value.
abstract  void setLong(int parameterIndex, long x)
          This method sets the specified parameter from the given Java long value.
abstract  void setNull(int parameterIndex, int sqlType)
          This method populates the specified parameter with a SQL NULL value for the specified type.
abstract  void setNull(int paramIndex, int sqlType, String typeName)
          This method populates the specified parameter with a SQL NULL value for the specified type.
abstract  void setObject(int parameterIndex, Object x)
          This method sets the specified parameter from the given Java Object value.
abstract  void setObject(int parameterIndex, Object x, int targetSqlType)
          This method sets the specified parameter from the given Java Object value.
abstract  void setObject(int parameterIndex, Object x, int targetSqlType, int scale)
          This method sets the specified parameter from the given Java Object value.
abstract  void setRef(int i, Ref x)
          This method sets the specified parameter from the given Java Ref value.
abstract  void setShort(int parameterIndex, short x)
          This method sets the specified parameter from the given Java short value.
abstract  void setString(int parameterIndex, String x)
          This method sets the specified parameter from the given Java String value.
abstract  void setTime(int parameterIndex, Time x)
          This method sets the specified parameter from the given Java java.sql.Time value.
abstract  void setTimestamp(int parameterIndex, Timestamp x)
          This method sets the specified parameter from the given Java java.sql.Timestamp value.
 
Methods inherited from class superwaba.ext.xplat.sql.Statement
addBatch, clearBatch, clearWarnings, close, execute, executeBatch, executeQuery, executeUpdate, getConnection, getFetchDirection, getFetchSize, getMaxFieldSize, getMaxRows, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetType, getUpdateCount, getWarnings, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setQueryTimeout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, toString, wait, wait
 

Constructor Detail

PreparedStatement

public PreparedStatement()
Method Detail

executeQuery

public abstract ResultSet executeQuery()
                                throws SQLException
This method executes a prepared SQL query and returns its ResultSet.
Returns:
The ResultSet of the SQL statement.
Throws:
SQLException - If an error occurs.

executeUpdate

public abstract int executeUpdate()
                           throws SQLException
This method executes an SQL INSERT, UPDATE or DELETE statement. SQL statements that return nothing such as SQL DDL statements can be executed.
Returns:
The result is either the row count for INSERT, UPDATE or DELETE statements; or 0 for SQL statements that return nothing.
Throws:
SQLException - If an error occurs.

setNull

public abstract void setNull(int parameterIndex,
                             int sqlType)
                      throws SQLException
This method populates the specified parameter with a SQL NULL value for the specified type.
Parameters:
index - The index of the parameter to set.
type - The SQL type identifier of the parameter from Types
Throws:
SQLException - If an error occurs.

setBoolean

public abstract void setBoolean(int parameterIndex,
                                boolean x)
                         throws SQLException
This method sets the specified parameter from the given Java boolean value.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
Throws:
SQLException - If an error occurs.

setByte

public abstract void setByte(int parameterIndex,
                             byte x)
                      throws SQLException
This method sets the specified parameter from the given Java byte value.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
Throws:
SQLException - If an error occurs.

setShort

public abstract void setShort(int parameterIndex,
                              short x)
                       throws SQLException
This method sets the specified parameter from the given Java short value.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
Throws:
SQLException - If an error occurs.

setInt

public abstract void setInt(int parameterIndex,
                            int x)
                     throws SQLException
This method sets the specified parameter from the given Java int value.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
Throws:
SQLException - If an error occurs.

setLong

public abstract void setLong(int parameterIndex,
                             long x)
                      throws SQLException
This method sets the specified parameter from the given Java long value.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
Throws:
SQLException - If an error occurs.

setFloat

public abstract void setFloat(int parameterIndex,
                              float x)
                       throws SQLException
This method sets the specified parameter from the given Java float value.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
Throws:
SQLException - If an error occurs.

setDouble

public abstract void setDouble(int parameterIndex,
                               double x)
                        throws SQLException
This method sets the specified parameter from the given Java double value.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
Throws:
SQLException - If an error occurs.

setString

public abstract void setString(int parameterIndex,
                               String x)
                        throws SQLException
This method sets the specified parameter from the given Java String value.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
Throws:
SQLException - If an error occurs.

setBytes

public abstract void setBytes(int parameterIndex,
                              byte[] x)
                       throws SQLException
This method sets the specified parameter from the given Java byte array value.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
Throws:
SQLException - If an error occurs.

setBytes

public abstract void setBytes(int parameterIndex,
                              byte[] x,
                              int start,
                              int length)
                       throws SQLException
This method sets the specified parameter from the given Java byte array value. This method is new for SuperWaba, and is included to allow optimized byte array functionality in small devices.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
start - index into byte array from which to begin pulling bytes to store in parameter.
length - number of bytes to pull from byte array to store in parameter.
Throws:
SQLException - If an error occurs.

setDate

public abstract void setDate(int parameterIndex,
                             Date x)
                      throws SQLException
This method sets the specified parameter from the given Java java.sql.Date value.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
Throws:
SQLException - If an error occurs.

setTime

public abstract void setTime(int parameterIndex,
                             Time x)
                      throws SQLException
This method sets the specified parameter from the given Java java.sql.Time value.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
Throws:
SQLException - If an error occurs.

setTimestamp

public abstract void setTimestamp(int parameterIndex,
                                  Timestamp x)
                           throws SQLException
This method sets the specified parameter from the given Java java.sql.Timestamp value.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
Throws:
SQLException - If an error occurs.

clearParameters

public abstract void clearParameters()
                              throws SQLException
This method clears all of the input parameter that have been set on this statement.
Throws:
SQLException - If an error occurs.

setObject

public abstract void setObject(int parameterIndex,
                               Object x,
                               int targetSqlType,
                               int scale)
                        throws SQLException
This method sets the specified parameter from the given Java Object value. The specified SQL object type will be used.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
type - The SQL type to use for the parameter, from Types
scale - The scale of the value, for numeric values only.
Throws:
SQLException - If an error occurs.
See Also:
Types

setObject

public abstract void setObject(int parameterIndex,
                               Object x,
                               int targetSqlType)
                        throws SQLException
This method sets the specified parameter from the given Java Object value. The specified SQL object type will be used.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
type - The SQL type to use for the parameter, from Types
Throws:
SQLException - If an error occurs.
See Also:
Types

setObject

public abstract void setObject(int parameterIndex,
                               Object x)
                        throws SQLException
This method sets the specified parameter from the given Java Object value. The default object type to SQL type mapping will be used.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
Throws:
SQLException - If an error occurs.

execute

public abstract boolean execute()
                         throws SQLException
This method executes a prepared SQL query. Some prepared statements return multiple results; the execute method handles these complex statements as well as the simpler form of statements handled by executeQuery and executeUpdate.
Returns:
The result of the SQL statement.
Throws:
SQLException - If an error occurs.

addBatch

public abstract void addBatch()
                       throws SQLException
This method adds a set of parameters to the batch for JDBC 2.0.
Throws:
SQLException - If an error occurs.

setRef

public abstract void setRef(int i,
                            Ref x)
                     throws SQLException
This method sets the specified parameter from the given Java Ref value. The default object type to SQL type mapping will be used.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
Throws:
SQLException - If an error occurs.

setBlob

public abstract void setBlob(int i,
                             Blob x)
                      throws SQLException
This method sets the specified parameter from the given Java Blob value. The default object type to SQL type mapping will be used.
Parameters:
index - The index of the parameter value to set.
value - The value of the parameter.
Throws:
SQLException - If an error occurs.

getMetaData

public abstract ResultSetMetaData getMetaData()
                                       throws SQLException
This method returns meta data for the result set from this statement.
Returns:
Meta data for the result set from this statement.
Throws:
SQLException - If an error occurs.

setNull

public abstract void setNull(int paramIndex,
                             int sqlType,
                             String typeName)
                      throws SQLException
This method populates the specified parameter with a SQL NULL value for the specified type.
Parameters:
index - The index of the parameter to set.
type - The SQL type identifier of the parameter from Types
name - The name of the data type, for user defined types.
Throws:
SQLException - If an error occurs.

getParameterMetaData

public abstract ParameterMetaData getParameterMetaData()
                                                throws SQLException
Since:
1.4