|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tentackle.db.StatementWrapper
org.tentackle.db.PreparedStatementWrapper
public class PreparedStatementWrapper
A wrapper for prepared statements.
Will catch and report SQLExceptions and
keep track of being used only once after Db.getPreparedStatement(int).
| Field Summary |
|---|
| Fields inherited from class org.tentackle.db.StatementWrapper |
|---|
con, ready, stmt |
| Constructor Summary | |
|---|---|
PreparedStatementWrapper(ManagedConnection con,
PreparedStatement stmt)
Creates a wrapper for a prepared statement. |
|
| Method Summary | |
|---|---|
ResultSetWrapper |
executeQuery()
Executes the query. |
ResultSetWrapper |
executeQuery(boolean withinTx)
Executes the query. |
int |
executeUpdate()
Executes the update. |
int |
getColumnOffset()
Gets the column offset. |
PreparedStatement |
getStatement()
Gets the wrapped prepared statement. |
void |
setBigDecimal(int p,
BigDecimal d)
Sets the designated parameter to the given java.math.BigDecimal value. |
void |
setBinary(int p,
Binary b)
Sets the designated parameter to the given Binary value. |
void |
setBMoney(int p,
BMoney m)
Sets the designated parameter to a BMoney value.A BMoney will not be stored as a single field but as two fields: a double representing the value an int representing the scale This is due to most DBMS can't store arbitrary scaled decimals in a single column, i.e. |
void |
setBoolean(int p,
boolean b)
Sets the designated parameter to the given Java boolean value. |
void |
setBoolean(int p,
Boolean b)
Sets the designated parameter to the given Java Boolean value. |
void |
setByte(int p,
byte b)
Sets the designated parameter to the given Java byte value. |
void |
setByte(int p,
Byte b)
Sets the designated parameter to the given Java Byte value. |
void |
setChar(int p,
char c)
Sets the designated parameter to the given Java char value. |
void |
setCharacter(int p,
Character c)
Sets the designated parameter to the given Java Character value. |
void |
setCharacter(int p,
Character c,
boolean mapNull)
Sets the designated parameter to the given Java Character value. |
void |
setColumnOffset(int columnOffset)
Sets the column offset. |
void |
setDate(int p,
Date d)
Sets the designated parameter to the given java.sql.Date value
using the default time zone of the virtual machine that is running
the application. |
void |
setDate(int p,
Date d,
boolean mapNull)
Sets the designated parameter to the given java.sql.Date value
using the default time zone of the virtual machine that is running
the application. |
void |
setDMoney(int p,
DMoney m)
Sets the designated parameter to a DMoney value.A DMoney will not be stored as a single field but as two fields: a BigDecimal with a scale of 0 representing the value an int representing the scale This is due to most DBMS can't store arbitrary scaled decimals in a single column, i.e. |
void |
setDouble(int p,
double d)
Sets the designated parameter to the given Java double value. |
void |
setDouble(int p,
Double d)
Sets the designated parameter to the given Java Double value. |
void |
setFloat(int p,
float f)
Sets the designated parameter to the given Java float value. |
void |
setFloat(int p,
Float f)
Sets the designated parameter to the given Java Float value. |
void |
setInt(int p,
int i)
Sets the designated parameter to the given Java int value. |
void |
setInteger(int p,
Integer i)
Sets the designated parameter to the given Java Integer value. |
void |
setLong(int p,
long l)
Sets the designated parameter to the given Java long value. |
void |
setLong(int p,
Long l)
Sets the designated parameter to the given Java Long value. |
void |
setNull(int pos,
int type)
Sets the designated parameter to SQL NULL. |
void |
setShort(int p,
short s)
Sets the designated parameter to the given Java short value. |
void |
setShort(int p,
Short s)
Sets the designated parameter to the given Java Short value. |
void |
setString(int p,
String s)
Sets the designated parameter to the given Java String value. |
void |
setString(int p,
String s,
boolean mapNull)
Sets the designated parameter to the given Java String value. |
void |
setTime(int p,
Time t)
Sets the designated parameter to the given java.sql.Time value. |
void |
setTimestamp(int p,
Timestamp ts)
Sets the designated parameter to the given java.sql.Timestamp value. |
void |
setTimestamp(int p,
Timestamp ts,
boolean mapNull)
Sets the designated parameter to the given java.sql.Timestamp value. |
| Methods inherited from class org.tentackle.db.StatementWrapper |
|---|
close, detachDb, executeQuery, executeQuery, executeUpdate, getConnection, getDb, getFetchDirection, getFetchSize, getMaxRows, isClosed, isMarkedReady, markReady, setFetchDirection, setFetchSize, setMaxRows, toString, unmarkReady |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PreparedStatementWrapper(ManagedConnection con,
PreparedStatement stmt)
con - stmt - | Method Detail |
|---|
public PreparedStatement getStatement()
getStatement in class StatementWrapperpublic void setColumnOffset(int columnOffset)
columnOffset - (default is 0)public int getColumnOffset()
public int executeUpdate()
public ResultSetWrapper executeQuery(boolean withinTx)
withinTx - is true if start a transaction for this query.
public ResultSetWrapper executeQuery()
public void setNull(int pos,
int type)
NULL.
pos - the first parameter is 1, the second is 2, ...type - the SQL type code defined in java.sql.Types
public void setString(int p,
String s,
boolean mapNull)
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.
p - the first parameter is 1, the second is 2, ...s - the parameter valuemapNull - true if null values should be mapped to the empty string, else SQL NULL
public void setString(int p,
String s)
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.
p - the first parameter is 1, the second is 2, ...s - the parameter value, null if the value should be set to SQL NULL
public void setBoolean(int p,
boolean b)
boolean value.
The driver converts this
to an SQL BIT or BOOLEAN value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...b - the parameter value
public void setBoolean(int p,
Boolean b)
Boolean value.
The driver converts this
to an SQL BIT or BOOLEAN value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...b - the parameter value, null if the value should be set to SQL NULL
public void setByte(int p,
byte b)
byte value.
The driver converts this
to an SQL TINYINT value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...b - the parameter value
public void setByte(int p,
Byte b)
Byte value.
The driver converts this
to an SQL TINYINT value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...b - the parameter value, null if the value should be set to SQL NULL
public void setChar(int p,
char c)
char value.
The driver converts this
to an SQL VARCHAR
when it sends it to the database.
p - the first parameter is 1, the second is 2, ...c - the parameter value
public void setCharacter(int p,
Character c,
boolean mapNull)
Character value.
The driver converts this
to an SQL VARCHAR
when it sends it to the database.
p - the first parameter is 1, the second is 2, ...c - the parameter value, null if the value should be set to SQL NULLmapNull - true if null values should be mapped to BLANK, else SQL NULL
public void setCharacter(int p,
Character c)
Character value.
The driver converts this
to an SQL VARCHAR
when it sends it to the database.
p - the first parameter is 1, the second is 2, ...c - the parameter value, null if the value should be set to SQL NULL
public void setShort(int p,
short s)
short value.
The driver converts this
to an SQL SMALLINT value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...s - the parameter value
public void setShort(int p,
Short s)
Short value.
The driver converts this
to an SQL SMALLINT value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...s - the parameter value, null if the value should be set to SQL NULL
public void setInt(int p,
int i)
int value.
The driver converts this
to an SQL INTEGER value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...i - the parameter value
public void setInteger(int p,
Integer i)
Integer value.
The driver converts this
to an SQL INTEGER value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...i - the parameter value, null if the value should be set to SQL NULL
public void setLong(int p,
long l)
long value.
The driver converts this
to an SQL BIGINT value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...l - the parameter value
public void setLong(int p,
Long l)
Long value.
The driver converts this
to an SQL BIGINT value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...l - the parameter value, null if the value should be set to SQL NULL
public void setFloat(int p,
float f)
float value.
The driver converts this
to an SQL REAL value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...f - the parameter value
public void setFloat(int p,
Float f)
Float value.
The driver converts this
to an SQL REAL value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...f - the parameter value, null if the value should be set to SQL NULL
public void setDouble(int p,
double d)
double value.
The driver converts this
to an SQL DOUBLE value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...d - the parameter value
public void setDouble(int p,
Double d)
Double value.
The driver converts this
to an SQL DOUBLE value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...d - the parameter value, null if the value should be set to SQL NULL
public void setBigDecimal(int p,
BigDecimal d)
java.math.BigDecimal value.
The driver converts this to an SQL NUMERIC value when
it sends it to the database.
p - the first parameter is 1, the second is 2, ...d - the parameter value, null if the value should be set to SQL NULL
public void setBMoney(int p,
BMoney m)
BMoney value.
p - the sql positionm - the money value, null to set SQL NULLsetDMoney(int, org.tentackle.util.DMoney)
public void setDMoney(int p,
DMoney m)
DMoney value.
p - the sql positionm - the money value, null to set SQL NULLsetBMoney(int, org.tentackle.util.BMoney)
public void setDate(int p,
Date d,
boolean mapNull)
java.sql.Date value
using the default time zone of the virtual machine that is running
the application.
The driver converts this
to an SQL DATE value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...d - the parameter valuemapNull - to map null values to 1.1.1970 (epochal time zero), else SQL NULL
public void setDate(int p,
Date d)
java.sql.Date value
using the default time zone of the virtual machine that is running
the application.
The driver converts this
to an SQL DATE value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...d - the parameter value, null if the value should be set to SQL NULL
public void setTimestamp(int p,
Timestamp ts,
boolean mapNull)
java.sql.Timestamp value.
The driver
converts this to an SQL TIMESTAMP value when it sends it to the
database.
p - the first parameter is 1, the second is 2, ...ts - the parameter valuemapNull - to map null values to 1.1.1970 00:00:00.000 (epochal time zero),
else SQL NULL
public void setTimestamp(int p,
Timestamp ts)
java.sql.Timestamp value.
The driver
converts this to an SQL TIMESTAMP value when it sends it to the
database.
p - the first parameter is 1, the second is 2, ...ts - the parameter value, null if the value should be set to SQL NULL
public void setTime(int p,
Time t)
java.sql.Time value.
The driver converts this
to an SQL TIME value when it sends it to the database.
p - the first parameter is 1, the second is 2, ...t - the parameter value, null if the value should be set to SQL NULL
public void setBinary(int p,
Binary b)
Binary value.
will
The driver converts this to an SQL BLOB value when it sends it to the
database.
The implementation translates the Binary into an Inputstream and invokes
PreparedStatement.setBinaryStream(int, java.io.InputStream, int).
p - the first parameter is 1, the second is 2, ...b - the parameter value, null if the value should be set to SQL NULL
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||