|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.walend.jdbc.SQLStatementString
This class exists to provide '?' substitutions to Statements that are not PreparedStatements.
Field Summary | |
private java.lang.String[] |
parameters
|
private java.lang.String |
sqlString
|
Constructor Summary | |
SQLStatementString(java.lang.String sqlString)
|
Method Summary | |
void |
clearParameters()
Clears the current parameter values immediately. |
private int |
countParameters()
|
private java.lang.String |
escapeSingleQuotes(java.lang.String string)
|
private java.lang.String |
getParameter(int i)
|
java.lang.String |
getSQLString()
|
private boolean |
parametersFilled()
|
void |
setBoolean(int parameterIndex,
boolean x)
Sets the designated parameter to a Java boolean value. |
void |
setByte(int parameterIndex,
byte x)
Sets the designated parameter to a Java byte value. |
void |
setBytes(int parameterIndex,
byte[] x)
Sets the designated parameter to a Java array of bytes. |
void |
setDate(int parameterIndex,
java.sql.Date x)
Sets the designated parameter to a value. |
void |
setDate(int parameterIndex,
java.util.Date x)
|
void |
setDouble(int parameterIndex,
double x)
Sets the designated parameter to a Java double value. |
void |
setFloat(int parameterIndex,
float x)
Sets the designated parameter to a Java float value. |
void |
setInt(int parameterIndex,
int x)
Sets the designated parameter to a Java int value. |
void |
setLong(int parameterIndex,
long x)
Sets the designated parameter to a Java long value. |
void |
setNull(int parameterIndex,
int sqlType)
Sets the designated parameter to SQL NULL . |
void |
setObject(int parameterIndex,
java.lang.Object x)
|
private void |
setParameter(int i,
java.lang.String string)
This method changes the parameters from 1-based (jdbc) to 0-based (everything else). |
void |
setShort(int parameterIndex,
short x)
Sets the designated parameter to a Java short value. |
void |
setString(int parameterIndex,
java.lang.String x)
Sets the designated parameter to a Java String value. |
void |
setStringNoQuotes(int parameterIndex,
java.lang.String x)
Sets the designated parameter to a Java String value without quotes. |
void |
setTime(int parameterIndex,
java.sql.Time x)
Sets the designated parameter to a java.sql.Time value. |
void |
setTimestamp(int parameterIndex,
java.sql.Timestamp x)
Sets the designated parameter to a java.sql.Timestamp value. |
private int[] |
whichParametersMissing()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.lang.String sqlString
private java.lang.String[] parameters
Constructor Detail |
public SQLStatementString(java.lang.String sqlString)
Method Detail |
private boolean parametersFilled()
private int[] whichParametersMissing()
private java.lang.String getParameter(int i)
public java.lang.String getSQLString() throws java.sql.SQLException
private int countParameters()
private void setParameter(int i, java.lang.String string)
public void setNull(int parameterIndex, int sqlType) throws java.sql.SQLException
NULL
.
Note: You must specify the parameter's SQL type.
parameterIndex
- the first parameter is 1, the second is 2, ...sqlType
- the SQL type code defined in java.sql.Types
java.sql.SQLException
- if a database access error occurspublic void setBoolean(int parameterIndex, boolean x) throws java.sql.SQLException
boolean
value. The driver converts this
to an SQL BIT
value when it sends it to the database.
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter valuejava.sql.SQLException
- if a database access error occurspublic void setByte(int parameterIndex, byte x) throws java.sql.SQLException
byte
value. The driver converts this
to an SQL TINYINT
value when it sends it to the database.
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter valuejava.sql.SQLException
- if a database access error occurspublic void setShort(int parameterIndex, short x) throws java.sql.SQLException
short
value. The driver converts this
to an SQL SMALLINT
value when it sends it to the database.
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter valuejava.sql.SQLException
- if a database access error occurspublic void setInt(int parameterIndex, int x) throws java.sql.SQLException
int
value. The driver converts this
to an SQL INTEGER
value when it sends it to the database.
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter valuejava.sql.SQLException
- if a database access error occurspublic void setLong(int parameterIndex, long x) throws java.sql.SQLException
long
value. The driver converts this
to an SQL BIGINT
value when it sends it to the database.
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter valuejava.sql.SQLException
- if a database access error occurspublic void setFloat(int parameterIndex, float x) throws java.sql.SQLException
float
value. The driver converts this
to an SQL FLOAT
value when it sends it to the database.
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter valuejava.sql.SQLException
- if a database access error occurspublic void setDouble(int parameterIndex, double x) throws java.sql.SQLException
double
value. The driver converts this
to an SQL DOUBLE
value when it sends it to the database.
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter valuejava.sql.SQLException
- if a database access error occursprivate java.lang.String escapeSingleQuotes(java.lang.String string)
public void setString(int parameterIndex, java.lang.String x) throws java.sql.SQLException
String
value. The driver converts this
to an SQL VARCHAR
or LONGVARCHAR
value (depending on the argument's
size relative to the driver's limits on VARCHAR
values) when it sends it to the database.
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter valuejava.sql.SQLException
- if a database access error occurspublic void setStringNoQuotes(int parameterIndex, java.lang.String x) throws java.sql.SQLException
String
value without quotes.
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter valuejava.sql.SQLException
- if a database access error occurspublic void setBytes(int parameterIndex, byte[] x) throws java.sql.SQLException
VARBINARY
or LONGVARBINARY
(depending on the argument's size relative to the driver's limits on
VARBINARY
values) when it sends it to the database.
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter valuejava.sql.SQLException
- if a database access error occurspublic void setDate(int parameterIndex, java.sql.Date x) throws java.sql.SQLException
value. The driver converts this
to an SQL DATE
value when it sends it to the database.
- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
public void setDate(int parameterIndex, java.util.Date x) throws java.sql.SQLException
public void setTime(int parameterIndex, java.sql.Time x) throws java.sql.SQLException
java.sql.Time
value. The driver converts this
to an SQL TIME
value when it sends it to the database.
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter valuejava.sql.SQLException
- if a database access error occurspublic void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws java.sql.SQLException
java.sql.Timestamp
value. The driver
converts this to an SQL TIMESTAMP
value when it sends it to the database.
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter valuejava.sql.SQLException
- if a database access error occurspublic void setObject(int parameterIndex, java.lang.Object x) throws java.sql.SQLException
public void clearParameters() throws java.sql.SQLException
In general, parameter values remain in force for repeated
use of a statement. Setting a parameter value automatically clears its
previous value. However, in some cases it is useful to immediately
release the resources used by the current parameter values; this can
be done by calling the method clearParameters
.
java.sql.SQLException
- if a database access error occurs
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |