|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.arsdigita.acs.db.SqlStatement
Utility class for bundling a SQL statement with its bind values.
| Constructor Summary | |
SqlStatement()
|
|
| Method Summary | |
void |
addBindValue(Object o)
Deprecated. |
void |
addBindValue(String name,
Object o)
Deprecated. |
SqlStatement |
append(SqlStatement s)
Allows combining of SQL statements, including their bind variables. |
SqlStatement |
append(String s)
Adds to the SQL command string for this statement. |
void |
bind(Object o)
Adds a bind value to this statement. |
void |
bind(String name,
Object o)
Adds a named bind value to this statement. |
void |
bindFixup()
This is called by the end of a SqlTag (e.g., db_query) to tell us that we're done with bind variables, and that we should go put the extra (named) ones in their places. |
void |
clear()
Clears this statement. |
Object[] |
getBindValues()
Returns a list of bind values. |
String |
getSql()
|
boolean |
isSet()
|
void |
setSql(String s)
Sets the SQL command string for this statement. |
String |
toString()
Performs a fixup and returns a string containg the SQL followed by the bind values. |
| Methods inherited from class java.lang.Object |
|
| Constructor Detail |
public SqlStatement()
| Method Detail |
public void clear()
public String getSql()
public boolean isSet()
public void setSql(String s)
s - The SQL commandpublic SqlStatement append(String s)
s - The SQL command.public SqlStatement append(SqlStatement s)
"select to_date(:the_date, 'YYYY-MM-DD HH24:MI:SS')" and the value
of :the_date) and then inserting them into a larger SQL statement
(stmnt.append("SELECT ").append(dateStmnt).append(" FROM dual")).
Note that bind values from the appended statement are not bound with other variables in
this statement. So, extending the above example:
(stmnt.append("SELECT ").append(dateStmnt).append(", :the_date").append(" FROM dual")).
":the_date" inside of dateStmnt will be bound in this statement, but the ":the_date" which was
appended afterwards is not presently bound.
stmnt.bind("the_date", someValue); is necessary to bind this second "the_date".
SqlStatement - to append.public void addBindValue(Object o)
o - The object to bindpublic void bind(Object o)
o - The object to bind
public void addBindValue(String name,
Object o)
name - The name of the bind variableo - The object to bind
public void bind(String name,
Object o)
name - The name of the bind variableo - The object to bindpublic void bindFixup()
public Object[] getBindValues()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||