|
Openfire 3.6.1 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jivesoftware.database.CachedPreparedStatement
public class CachedPreparedStatement
Allows PreparedStatement information to be cached. A prepared statement consists of a SQL statement containing bind variables as well as variable values. For example, the SQL statement "SELECT * FROM person WHERE age > ?" would have the integer variable 18 (which replaces the "?" chracter) to find all adults. This class encapsulates both the SQL string and bind variable values so that actual PreparedStatement can be created from that information later.
Constructor Summary | |
---|---|
CachedPreparedStatement()
Constructs a new CachedPreparedStatement. |
|
CachedPreparedStatement(String sql)
Constructs a new CachedPreparedStatement. |
Method Summary | |
---|---|
void |
addBoolean(boolean value)
Adds a boolean parameter to the prepared statement. |
void |
addInt(int value)
Adds an integer parameter to the prepared statement. |
void |
addLong(long value)
Adds a long parameter to the prepared statement. |
void |
addString(String value)
Adds a String parameter to the prepared statement. |
boolean |
equals(Object object)
|
String |
getSQL()
Returns the SQL. |
int |
hashCode()
|
void |
setParams(PreparedStatement pstmt)
Sets all parameters on the given PreparedStatement. |
void |
setSQL(String sql)
Sets the SQL. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CachedPreparedStatement()
public CachedPreparedStatement(String sql)
sql
- the SQL.Method Detail |
---|
public String getSQL()
public void setSQL(String sql)
sql
- the SQL.public void addBoolean(boolean value)
value
- the boolean value.public void addInt(int value)
value
- the int value.public void addLong(long value)
value
- the long value.public void addString(String value)
value
- the String value.public void setParams(PreparedStatement pstmt) throws SQLException
PreparedStatement pstmt = con.prepareStatement(cachedPstmt.getSQL()); cachedPstmt.setParams(pstmt);
pstmt
- the prepared statement.
SQLException
- if an SQL Exception occurs.public boolean equals(Object object)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
Openfire 3.6.1 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |