java.lang.Objectorg.objectweb.telosys.common.TelosysObject
org.objectweb.telosys.dal.dao.QueryContext
The context of a query ( contains the PreparedStatement and the ResultSet of the query )
This is an internal framework class, designed to be used by the StandardDAO and all its descendents
Field Summary | |
static boolean |
RETURN_GENERATED_KEYS
|
Constructor Summary | |
QueryContext(java.sql.Connection con,
java.lang.String sSql)
Constructs a new query context for the given SQL request ( get a PreparedStatement ) |
|
QueryContext(java.sql.Connection con,
java.lang.String sSql,
boolean bReturnGeneratedKeys)
Constructs a new query context for the given SQL request ( get a PreparedStatement ) |
Method Summary | |
protected void |
close()
Close the PreparedStatement AND the ResultSet Doesn't throw Exception (just trace the error) |
protected java.lang.Long |
executeInsertKeyGen()
Executes an INSERT with KEY GENERATION ( Autoincrement Key ) |
protected java.sql.ResultSet |
executeQuery()
Call the "executeQuery" method of the current PreparedStatement |
protected int |
executeUpdate()
Call the "executeUpdate" method of the current PreparedStatement |
java.math.BigDecimal |
getResultBigDecimal(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
java.sql.Blob |
getResultBlob(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
byte[] |
getResultBlobAsByteArray(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
boolean |
getResultBoolean(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
boolean |
getResultBooleanFromInt(int iPosition,
int iTrueValue)
Returns the value of the designated column in the current row of the ResultSet For a boolean stored as an integer value in the table |
boolean |
getResultBooleanFromString(int iPosition,
java.lang.String sTrueValue)
Returns the value of the designated column in the current row of the ResultSet For a boolean stored as an String value in the table |
java.lang.Boolean |
getResultBooleanObject(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
byte |
getResultByte(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
java.lang.Byte |
getResultByteObject(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
byte[] |
getResultBytes(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
java.sql.Clob |
getResultClob(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
java.util.Date |
getResultDate(int iPosition)
Returns the value of the designated column in the current row of the ResultSet Returns a java.util.Date instance created with the java.sql.Date returned by the ResultSet |
java.sql.Date |
getResultDateSql(int iPosition)
Returns the value of the designated column in the current row of the ResultSet Returns the java.sql.Date returned by the ResultSet |
double |
getResultDouble(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
java.lang.Double |
getResultDoubleObject(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
float |
getResultFloat(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
java.lang.Float |
getResultFloatObject(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
int |
getResultInt(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
java.lang.Integer |
getResultIntObject(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
long |
getResultLong(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
java.lang.Long |
getResultLongObject(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
short |
getResultShort(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
java.lang.Short |
getResultShortObject(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
java.lang.String |
getResultString(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
java.sql.Time |
getResultTime(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
java.util.Date |
getResultTimeAsDate(int iPosition)
Returns the value of the designated column in the current row of the ResultSet For a TIME value in the table, returned as java.util.Date |
java.sql.Timestamp |
getResultTimestamp(int iPosition)
Returns the value of the designated column in the current row of the ResultSet |
java.util.Date |
getResultTimestampAsDate(int iPosition)
Returns the value of the designated column in the current row of the ResultSet For a TIMESTAMP value in the table, returned as java.util.Date |
protected boolean |
nextResult()
Moves the cursor down one row from its current position in the ResultSet Calls the "next" method of the current ResultSet |
void |
setParamBigDecimal(int i,
java.math.BigDecimal value)
Set a parameter in the PreparedStatement |
void |
setParamBlob(int i,
java.sql.Blob param)
Set a parameter in the PreparedStatement |
void |
setParamBlob(int i,
byte[] bytes)
Set a parameter in the PreparedStatement |
void |
setParamBoolean(int i,
boolean bValue)
Set a parameter in the PreparedStatement |
void |
setParamBoolean(int i,
java.lang.Boolean obj)
Set a parameter in the PreparedStatement |
void |
setParamBooleanAsInt(int i,
boolean bValue,
int iTrueValue,
int iFalseValue)
Set a parameter in the PreparedStatement For a boolean stored as an integer value in the table |
void |
setParamBooleanAsString(int i,
boolean bValue,
java.lang.String sTrueValue,
java.lang.String sFalseValue)
Set a parameter in the PreparedStatement For a boolean stored as an String value in the table |
void |
setParamByte(int i,
byte value)
Set a parameter in the PreparedStatement |
void |
setParamByte(int i,
java.lang.Byte obj)
Set a parameter in the PreparedStatement |
void |
setParamBytes(int i,
byte[] bytes)
Set a parameter in the PreparedStatement |
void |
setParamClob(int i,
java.sql.Clob param)
Set a parameter in the PreparedStatement |
void |
setParamDate(int i,
java.util.Date dateValue)
Set a parameter in the PreparedStatement Converts the given java.util.Date to java.sql.Date and set it as Date parameter |
void |
setParamDouble(int i,
double dValue)
Set a parameter in the PreparedStatement |
void |
setParamDouble(int i,
java.lang.Double obj)
Set a parameter in the PreparedStatement |
void |
setParamFloat(int i,
float fValue)
Set a parameter in the PreparedStatement |
void |
setParamFloat(int i,
java.lang.Float obj)
Set a parameter in the PreparedStatement |
void |
setParamInt(int i,
int iValue)
Set a parameter in the PreparedStatement |
void |
setParamInt(int i,
java.lang.Integer obj)
Set a parameter in the PreparedStatement |
void |
setParamLong(int i,
long value)
Set a parameter in the PreparedStatement |
void |
setParamLong(int i,
java.lang.Long obj)
Set a parameter in the PreparedStatement |
void |
setParamShort(int i,
short value)
Set a parameter in the PreparedStatement |
void |
setParamShort(int i,
java.lang.Short obj)
Set a parameter in the PreparedStatement |
void |
setParamString(int i,
java.lang.String sValue)
Set a parameter in the PreparedStatement |
void |
setParamTime(int i,
java.util.Date dateValue)
Set a parameter in the PreparedStatement Converts the given java.util.Date to java.sql.Time and set it as Time parameter |
void |
setParamTime(int i,
java.sql.Time time)
Set a parameter in the PreparedStatement |
void |
setParamTimestamp(int i,
java.util.Date dateValue)
Set a parameter in the PreparedStatement Converts the given java.util.Date to java.sql.Timestamp and set it as Timestamp parameter |
void |
setParamTimestamp(int i,
java.sql.Timestamp timestamp)
Set a parameter in the PreparedStatement |
Methods inherited from class org.objectweb.telosys.common.TelosysObject |
error, error, error, getFlagTrace, info, setFlagTrace, trace, warn |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final boolean RETURN_GENERATED_KEYS
Constructor Detail |
public QueryContext(java.sql.Connection con, java.lang.String sSql) throws java.sql.SQLException
con
- sSql
-
java.sql.SQLException
public QueryContext(java.sql.Connection con, java.lang.String sSql, boolean bReturnGeneratedKeys) throws java.sql.SQLException
con
- sSql
- bReturnGeneratedKeys
- use RETURN_GENERATED_KEYS to return the generate key (useful for insertKeyGen)
java.sql.SQLException
Method Detail |
protected int executeUpdate() throws java.sql.SQLException
java.sql.SQLException
protected java.sql.ResultSet executeQuery() throws java.sql.SQLException
java.sql.SQLException
protected java.lang.Long executeInsertKeyGen() throws java.sql.SQLException
java.sql.SQLException
protected void close()
public void setParamInt(int i, int iValue) throws TelosysException
i
- iValue
-
TelosysException
public void setParamInt(int i, java.lang.Integer obj) throws TelosysException
i
- obj
-
TelosysException
public void setParamByte(int i, byte value) throws TelosysException
i
- value
-
TelosysException
public void setParamByte(int i, java.lang.Byte obj) throws TelosysException
i
- obj
-
TelosysException
public void setParamShort(int i, short value) throws TelosysException
i
- value
-
TelosysException
public void setParamShort(int i, java.lang.Short obj) throws TelosysException
i
- obj
-
TelosysException
public void setParamLong(int i, long value) throws TelosysException
i
- value
-
TelosysException
public void setParamLong(int i, java.lang.Long obj) throws TelosysException
i
- obj
-
TelosysException
public void setParamFloat(int i, float fValue) throws TelosysException
i
- fValue
-
TelosysException
public void setParamFloat(int i, java.lang.Float obj) throws TelosysException
i
- obj
-
TelosysException
public void setParamDouble(int i, double dValue) throws TelosysException
i
- dValue
-
TelosysException
public void setParamDouble(int i, java.lang.Double obj) throws TelosysException
i
- obj
-
TelosysException
public void setParamBigDecimal(int i, java.math.BigDecimal value) throws TelosysException
i
- value
-
TelosysException
public void setParamString(int i, java.lang.String sValue) throws TelosysException
i
- sValue
-
TelosysException
public void setParamDate(int i, java.util.Date dateValue) throws TelosysException
i
- dateValue
-
TelosysException
public void setParamTimestamp(int i, java.util.Date dateValue) throws TelosysException
i
- dateValue
-
TelosysException
public void setParamTimestamp(int i, java.sql.Timestamp timestamp) throws TelosysException
i
- timestamp
-
TelosysException
public void setParamTime(int i, java.util.Date dateValue) throws TelosysException
i
- dateValue
-
TelosysException
public void setParamTime(int i, java.sql.Time time) throws TelosysException
i
- time
-
TelosysException
public void setParamBytes(int i, byte[] bytes) throws TelosysException
i
- bytes
-
TelosysException
public void setParamBoolean(int i, boolean bValue) throws TelosysException
i
- bValue
-
TelosysException
public void setParamBoolean(int i, java.lang.Boolean obj) throws TelosysException
i
- obj
-
TelosysException
public void setParamBooleanAsString(int i, boolean bValue, java.lang.String sTrueValue, java.lang.String sFalseValue) throws TelosysException
i
- bValue
- the boolean valuesTrueValue
- the String value to use if the boolean is TRUE ( e.g. "1" or "T" )sFalseValue
- the String value to use if the boolean is FALSE ( e.g. "0" or "F" )
TelosysException
public void setParamBooleanAsInt(int i, boolean bValue, int iTrueValue, int iFalseValue) throws TelosysException
i
- bValue
- the boolean valueiTrueValue
- the integer value to use if the boolean is TRUE ( e.g. 1 )iFalseValue
- the integer value to use if the boolean is FALSE ( e.g. 0 )
TelosysException
public void setParamClob(int i, java.sql.Clob param) throws TelosysException
i
- param
- the CLOB object
TelosysException
public void setParamBlob(int i, byte[] bytes) throws TelosysException
i
- bytes
- the BLOB content (binary : array of bytes)
TelosysException
public void setParamBlob(int i, java.sql.Blob param) throws TelosysException
i
- param
- the BLOB object
TelosysException
public java.lang.String getResultString(int iPosition) throws TelosysException
iPosition
-
TelosysException
public int getResultInt(int iPosition) throws TelosysException
iPosition
-
TelosysException
public java.lang.Integer getResultIntObject(int iPosition) throws TelosysException
iPosition
-
TelosysException
public byte getResultByte(int iPosition) throws TelosysException
iPosition
-
TelosysException
public java.lang.Byte getResultByteObject(int iPosition) throws TelosysException
iPosition
-
TelosysException
public short getResultShort(int iPosition) throws TelosysException
iPosition
-
TelosysException
public java.lang.Short getResultShortObject(int iPosition) throws TelosysException
iPosition
-
TelosysException
public long getResultLong(int iPosition) throws TelosysException
iPosition
-
TelosysException
public java.lang.Long getResultLongObject(int iPosition) throws TelosysException
iPosition
-
TelosysException
public float getResultFloat(int iPosition) throws TelosysException
iPosition
-
TelosysException
public java.lang.Float getResultFloatObject(int iPosition) throws TelosysException
iPosition
-
TelosysException
public double getResultDouble(int iPosition) throws TelosysException
iPosition
-
TelosysException
public java.lang.Double getResultDoubleObject(int iPosition) throws TelosysException
iPosition
-
TelosysException
public java.math.BigDecimal getResultBigDecimal(int iPosition) throws TelosysException
iPosition
-
TelosysException
public java.util.Date getResultDate(int iPosition) throws TelosysException
iPosition
-
TelosysException
public java.sql.Date getResultDateSql(int iPosition) throws TelosysException
iPosition
-
TelosysException
public java.sql.Time getResultTime(int iPosition) throws TelosysException
iPosition
-
TelosysException
public java.util.Date getResultTimeAsDate(int iPosition) throws TelosysException
iPosition
-
TelosysException
public java.sql.Timestamp getResultTimestamp(int iPosition) throws TelosysException
iPosition
-
TelosysException
public java.util.Date getResultTimestampAsDate(int iPosition) throws TelosysException
iPosition
-
TelosysException
public byte[] getResultBytes(int iPosition) throws TelosysException
iPosition
-
TelosysException
public boolean getResultBoolean(int iPosition) throws TelosysException
iPosition
-
TelosysException
public java.lang.Boolean getResultBooleanObject(int iPosition) throws TelosysException
iPosition
-
TelosysException
public boolean getResultBooleanFromInt(int iPosition, int iTrueValue) throws TelosysException
iPosition
- iTrueValue
- the integer value thar means "TRUE" ( e.g. 1 )
TelosysException
public boolean getResultBooleanFromString(int iPosition, java.lang.String sTrueValue) throws TelosysException
iPosition
- sTrueValue
- the String value thar means "TRUE" ( e.g. "1" or "T" or "true" )
TelosysException
public java.sql.Clob getResultClob(int iPosition) throws TelosysException
iPosition
-
TelosysException
public byte[] getResultBlobAsByteArray(int iPosition) throws TelosysException
iPosition
-
TelosysException
public java.sql.Blob getResultBlob(int iPosition) throws TelosysException
iPosition
-
TelosysException
protected boolean nextResult() throws TelosysException
TelosysException