|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvortex.sql.vortexStatement
vortex.sql.vortexPreparedStatement
public class vortexPreparedStatement
A SQL statement is pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.
Note: The setXXX methods for setting IN parameter values must specify types that are compatible with the defined SQL type of the input parameter. For instance, if the IN parameter has SQL type Integer then setInt should be used.
If arbitrary parameter type conversions are required then the setObject method should be used with a target SQL type.
Connection.prepareStatement(java.lang.String),
ResultSet| Field Summary | |
|---|---|
protected int |
npa
Number of Parameters |
| Fields inherited from class vortex.sql.vortexStatement |
|---|
cName, conn, lcur, ldb, record, result |
| 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 | |
|---|---|
vortexPreparedStatement()
|
|
vortexPreparedStatement(java.sql.Connection c,
dbChannel db,
java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
|
|
| Method Summary | |
|---|---|
void |
addBatch()
Adds a set of parameters to the batch. |
void |
clearParameters()
In general parameter values remain in force for repeated use of a Statement. |
boolean |
execute()
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. |
java.sql.ResultSet |
executeQuery()
A prepared SQL query is executed and its ResultSet is returned. |
int |
executeUpdate()
Execute a SQL INSERT, UPDATE or DELETE statement. |
java.sql.ResultSetMetaData |
getMetaData()
Gets the number, types and properties of a ResultSet's columns. |
java.sql.ParameterMetaData |
getParameterMetaData()
Retrieves the number, types and properties of this PreparedStatement's parameters. |
void |
setArray(int col,
java.sql.Array x)
Sets an Array parameter. |
void |
setAsciiStream(int column,
java.io.InputStream x,
int length)
When a very large ASCII value is input to a LONGVARCHAR parameter it may be more practical to send it via a java.io.InputStream. |
void |
setBigDecimal(int column,
java.math.BigDecimal x)
Set a parameter to a java.sql.Numeric value. |
void |
setBinaryStream(int column,
java.io.InputStream x,
int length)
When a very large binary value is input to a LONGVARBINARY parameter it may be more practical to send it via a java.io.InputStream. |
void |
setBlob(int col,
java.sql.Blob x)
Sets a BLOB parameter. |
void |
setBoolean(int column,
boolean x)
Set a parameter to a Java boolean value. |
void |
setByte(int column,
byte x)
Set a parameter to a Java byte value. |
void |
setBytes(int column,
byte[] x)
Set a parameter to a Java array of bytes. |
void |
setCharacterStream(int col,
java.io.Reader reader,
int length)
Sets the designated parameter to the given Reader object, which is the given number of characters long. |
void |
setClob(int col,
java.sql.Clob x)
Sets a CLOB parameter. |
void |
setDate(int column,
java.sql.Date x)
Set a parameter to a java.sql.Date value. |
void |
setDate(int col,
java.sql.Date x,
java.util.Calendar cal)
Sets the designated parameter to a java.sql.Date value, using the given Calendar object. |
void |
setDouble(int column,
double x)
Set a parameter to a Java double value. |
void |
setFloat(int column,
float x)
Set a parameter to a Java float value. |
void |
setInt(int column,
int x)
Set a parameter to a Java int value. |
void |
setLong(int column,
long x)
Set a parameter to a Java long value. |
void |
setNull(int column,
int sqlType)
Set a parameter to SQL NULL. |
void |
setNull(int parameterIndex,
int sqlType,
java.lang.String typeName)
Sets the designated parameter to SQL NULL. |
void |
setObject(int col,
java.lang.Object x)
Set the value of a parameter using an object; use the java.lang equivalent objects for integral values. |
void |
setObject(int col,
java.lang.Object x,
int targetSqlType)
This method is like setObject above, but assumes scale of zero. |
void |
setObject(int col,
java.lang.Object x,
int targetSqlType,
int scale)
Set the value of a parameter using an object; use the java.lang equivalent objects for integral values. |
void |
setRef(int col,
java.sql.Ref x)
Sets a REF( |
void |
setShort(int column,
short x)
Set a parameter to a Java short value. |
void |
setString(int column,
java.lang.String x)
Set a parameter to a Java String value. |
void |
setTime(int column,
java.sql.Time x)
Set a parameter to a java.sql.Time value. |
void |
setTime(int parameterIndex,
java.sql.Time x,
java.util.Calendar cal)
Sets the designated parameter to a java.sql.Time value, using the given Calendar object. |
void |
setTimestamp(int column,
java.sql.Timestamp x)
Set a parameter to a java.sql.Timestamp value. |
void |
setTimestamp(int parameterIndex,
java.sql.Timestamp x,
java.util.Calendar cal)
Sets the designated parameter to a java.sql.Timestamp value, using the given Calendar object. |
void |
setUnicodeStream(int column,
java.io.InputStream x,
int length)
When a very large UNICODE value is input to a LONGVARCHAR parameter it may be more practical to send it via a java.io.InputStream. |
void |
setURL(int parameterIndex,
java.net.URL x)
Sets the designated parameter to the given URL value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 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 |
|---|
protected int npa
| Constructor Detail |
|---|
public vortexPreparedStatement(java.sql.Connection c,
dbChannel db,
java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
java.sql.SQLException
public vortexPreparedStatement()
throws java.sql.SQLException
java.sql.SQLException| Method Detail |
|---|
public java.sql.ResultSet executeQuery()
throws java.sql.SQLException
executeQuery in interface java.sql.PreparedStatementjava.sql.SQLException - Not use
public int executeUpdate()
throws java.sql.SQLException
executeUpdate in interface java.sql.PreparedStatementjava.sql.SQLException - thrown if DB actions fail.
public void setNull(int column,
int sqlType)
throws java.sql.SQLException
Note: You must specify the parameter's SQL type.
setNull in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...sqlType - SQL type code defined by java.sql.Types
java.sql.SQLException - thrown if column out of range
public void setBoolean(int column,
boolean x)
throws java.sql.SQLException
setBoolean in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...x - the parameter value
java.sql.SQLException - thrown if column out of range or unable to
bind parameter
public void setByte(int column,
byte x)
throws java.sql.SQLException
setByte in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...x - the parameter value
java.sql.SQLException - thrown if column out of range or unable to
bind parameter
public void setShort(int column,
short x)
throws java.sql.SQLException
setShort in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...x - the parameter value
java.sql.SQLException - thrown if column out of range or unable to
bind parameter
public void setInt(int column,
int x)
throws java.sql.SQLException
setInt in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...x - the parameter value
java.sql.SQLException - thrown if column out of range or unable to
bind parameter
public void setLong(int column,
long x)
throws java.sql.SQLException
setLong in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...x - the parameter value
java.sql.SQLException - thrown if column out of range or unable to
bind parameter
public void setFloat(int column,
float x)
throws java.sql.SQLException
setFloat in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...x - the parameter value
java.sql.SQLException - thrown if column out of range or unable to
bind parameter
public void setDouble(int column,
double x)
throws java.sql.SQLException
setDouble in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...x - the parameter value
java.sql.SQLException - thrown if column out of range or unable to
bind parameter
public void setBigDecimal(int column,
java.math.BigDecimal x)
throws java.sql.SQLException
setBigDecimal in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...x - the parameter value
java.sql.SQLException - thrown if column out of range or unable to
bind parameter
public void setString(int column,
java.lang.String x)
throws java.sql.SQLException
setString in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...x - the parameter value
java.sql.SQLException - thrown if column out of range or unable to
bind parameter
public void setBytes(int column,
byte[] x)
throws java.sql.SQLException
setBytes in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...x - the parameter value
java.sql.SQLException - thrown if column out of range or unable to
bind parameter
public void setDate(int column,
java.sql.Date x)
throws java.sql.SQLException
setDate in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...x - the parameter value
java.sql.SQLException - thrown if column out of range or unable to
bind parameter
public void setTime(int column,
java.sql.Time x)
throws java.sql.SQLException
setTime in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...x - the parameter value
java.sql.SQLException - thrown if column out of range or unable to
bind parameter
public void setTimestamp(int column,
java.sql.Timestamp x)
throws java.sql.SQLException
setTimestamp in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...x - the parameter value
java.sql.SQLException - thrown if column out of range or unable to
bind parameter
public void setAsciiStream(int column,
java.io.InputStream x,
int length)
throws java.sql.SQLException
Note: this stream object can either be a standard Java stream object, or your own subclass that implements the standard interface.
setAsciiStream in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...x - the java input stream which contains the ASCII parameter valuelength - the number of bytes in the stream
java.sql.SQLException - thrown if column out of range or unable to
bind parameter
public void setUnicodeStream(int column,
java.io.InputStream x,
int length)
throws java.sql.SQLException
Note: this stream object can either be a standard Java stream object, or your own subclass that implements the standard interface.
setUnicodeStream in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...x - the java input stream which contains the
UNICODE parameter value @param length the number of bytes in
the stream
java.sql.SQLException - thrown if column out of range or unable to
bind parameter
public void setBinaryStream(int column,
java.io.InputStream x,
int length)
throws java.sql.SQLException
Note: this stream object can either be a standard Java stream object, or your own subclass that implements the standard interface.
setBinaryStream in interface java.sql.PreparedStatementcolumn - the first parameter is 1, the second is 2, ...x - the java input stream which contains the binary parameter valuelength - the number of bytes in the stream
java.sql.SQLException - thrown if column out of range or unable to
bind parameter
public void clearParameters()
throws java.sql.SQLException
clearParameters in interface java.sql.PreparedStatementjava.sql.SQLException - thrown if column out of range
public void setObject(int col,
java.lang.Object x,
int targetSqlType,
int scale)
throws java.sql.SQLException
The given Java object will be converted to the targetSqlType before being sent to the database.
Note that this method may be used to pass datatabase specific abstract data types, by using a Driver specific Java type and using a targetSqlType of java.sql.types.OTHER.
setObject in interface java.sql.PreparedStatementcol - The first parameter is 1, the second is 2, ...x - The object containing the input parameter valuetargetSqlType - The SQL type (as defined in java.sql.Types) to be
sent to the database. The scale argument may further qualify this type.scale - For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types
this is the number of digits after the decimal. For all other
types this value will be ignored,
java.sql.SQLException - if object is not supportedTypes
public void setObject(int col,
java.lang.Object x,
int targetSqlType)
throws java.sql.SQLException
setObject in interface java.sql.PreparedStatementcol - The first parameter is 1, the second is 2, ...x - The object containing the input parameter valuetargetSqlType - The SQL type (as defined in java.sql.Types) to be
sent to the database.
java.sql.SQLException - if object not supported
public void setObject(int col,
java.lang.Object x)
throws java.sql.SQLException
The JDBC specification specifies a standard mapping from Java Object types to SQL types. The given argument java object will be converted to the corresponding SQL type before being sent to the database.
Note that this method may be used to pass database specific abstract data types, by using a Driver specific Java type.
setObject in interface java.sql.PreparedStatementcol - The first parameter is 1, the second is 2, ...x - The object containing the input parameter value
java.sql.SQLException - if object is not supported
public boolean execute()
throws java.sql.SQLException
execute in interface java.sql.PreparedStatementjava.sql.SQLException - thrown on database errorsStatement.execute(java.lang.String)
public void addBatch()
throws java.sql.SQLException
addBatch in interface java.sql.PreparedStatementjava.sql.SQLException
public java.sql.ParameterMetaData getParameterMetaData()
throws java.sql.SQLException
getParameterMetaData in interface java.sql.PreparedStatementjava.sql.SQLException
public void setCharacterStream(int col,
java.io.Reader reader,
int length)
throws java.sql.SQLException
setCharacterStream in interface java.sql.PreparedStatementcol - the first parameter is 1, the second is 2, ...reader - the java reader which contains the UNICODE datalength - the number of characters in the stream
java.sql.SQLException
public void setRef(int col,
java.sql.Ref x)
throws java.sql.SQLException
setRef in interface java.sql.PreparedStatementcol - the first parameter is 1, the second is 2, ...x - an object representing data of an SQL REF Type
java.sql.SQLException
public void setBlob(int col,
java.sql.Blob x)
throws java.sql.SQLException
setBlob in interface java.sql.PreparedStatementcol - the first parameter is 1, the second is 2, ...x - an object representing a BLOB
java.sql.SQLException
public void setClob(int col,
java.sql.Clob x)
throws java.sql.SQLException
setClob in interface java.sql.PreparedStatementcol - the first parameter is 1, the second is 2, ...x - an object representing a CLOB
java.sql.SQLException
public void setArray(int col,
java.sql.Array x)
throws java.sql.SQLException
setArray in interface java.sql.PreparedStatementcol - the first parameter is 1, the second is 2, ...x - an object representing an SQL array
java.sql.SQLException
public java.sql.ResultSetMetaData getMetaData()
throws java.sql.SQLException
getMetaData in interface java.sql.PreparedStatementjava.sql.SQLException
public void setDate(int col,
java.sql.Date x,
java.util.Calendar cal)
throws java.sql.SQLException
setDate in interface java.sql.PreparedStatementcol - the first parameter is 1, the second is 2, ...x - the parameter valuecal - the Calendar object the driver will use to construct the date
java.sql.SQLException
public void setTime(int parameterIndex,
java.sql.Time x,
java.util.Calendar cal)
throws java.sql.SQLException
setTime in interface java.sql.PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valuecal - the Calendar object the driver will use to construct the time
java.sql.SQLException
public void setTimestamp(int parameterIndex,
java.sql.Timestamp x,
java.util.Calendar cal)
throws java.sql.SQLException
setTimestamp in interface java.sql.PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valuecal - the Calendar object the driver will use to construct the
timestamp
java.sql.SQLException
public void setNull(int parameterIndex,
int sqlType,
java.lang.String typeName)
throws java.sql.SQLException
setNull in interface java.sql.PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...sqlType - a value from java.sql.TypestypeName - the fully-qualified name of an SQL user-named type, ignored
if the parameter is not a user-named type or REF
java.sql.SQLException
public void setURL(int parameterIndex,
java.net.URL x)
throws java.sql.SQLException
setURL in interface java.sql.PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - URL value
java.sql.SQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||