|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ora.jsp.beans.sql.SQLCommandBean
This class is a bean for executing SQL statements. It has three properties that can be set: connection, sqlValue and values. The connection and sqlValue properties must always be set before calling one of the execute methods. If the values property is set, the sqlValue property must be an SQL statement with question marks as placeholders for the value objects in the values property.
Field Summary | |
private java.sql.Connection |
conn
|
private java.lang.String |
sqlValue
|
private java.util.List |
values
|
Constructor Summary | |
SQLCommandBean()
|
Method Summary | |
javax.servlet.jsp.jstl.sql.Result |
executeQuery()
Executes the specified SQL string as a query and returns a Result object |
int |
executeUpdate()
Executes the specified SQL string (any statement except SELECT, such as UPDATE, INSERT, DELETE or CREATE TABLE) and returns the number of rows affected by the statement, or 0 if none. |
void |
setConnection(java.sql.Connection conn)
Sets the Connection to use. |
void |
setSqlValue(java.lang.String sqlValue)
Set the SQL string, possibly with question mark placeholders for values set by setValues(). |
void |
setValues(java.util.List values)
Sets the values to use for the place holders in the SQL string. |
private void |
setValues(java.sql.PreparedStatement pstmt,
java.util.List values)
Calls setObject() method on the PreparedStatement for all objects in the values List. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.sql.Connection conn
private java.lang.String sqlValue
private java.util.List values
Constructor Detail |
public SQLCommandBean()
Method Detail |
public void setConnection(java.sql.Connection conn)
public void setSqlValue(java.lang.String sqlValue)
public void setValues(java.util.List values)
public javax.servlet.jsp.jstl.sql.Result executeQuery() throws java.sql.SQLException
java.sql.SQLException
public int executeUpdate() throws java.sql.SQLException
java.sql.SQLException
private void setValues(java.sql.PreparedStatement pstmt, java.util.List values) throws java.sql.SQLException
pstmt
- the PreparedStatementvalues
- a List with objects
java.sql.SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |