|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.j256.ormlite.stmt.SelectArg
public class SelectArg
An argument to a select SQL statement. After the query is constructed, the caller can set the value on this argument and run the query. Then the argument can be set again and the query re-executed. This is equivalent in JDBC to a ? type argument.
NOTE: If the argument has not been set by the time the query is executed, an exception will be thrown.
NOTE: For protections sake, the object cannot be reused with different column names.
// build a query using the Account DAO
QueryBuilder<Account, String> qb = accountDao.queryBuilder();
// create an argument which will be set later
SelectArg passwordSelectArg = new SelectArg();
qb.where().eq(Account.PASSWORD_FIELD_NAME, passwordSelectArg);
// prepare the query
PreparedQuery<Account> preparedQuery = qb.prepareQuery();
// ...
// some time later we set the value and run the query
passwordSelectArg.setValue("_secret");
List<Account> results = accountDao.query(preparedQuery);
// we can then re-set the value and re-run the query
passwordSelectArg.setValue("qwerty");
List<Account> results = accountDao.query(preparedQuery);
| Constructor Summary | |
|---|---|
SelectArg()
|
|
| Method Summary | |
|---|---|
String |
getColumnName()
Return the column-name associated with this argument. |
Object |
getValue()
Return the value associated with this argument. |
void |
setColumnName(String columnName)
Used internally by the package to set the column-name associated with this argument. |
void |
setValue(Object value)
Set the value associated with this argument. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SelectArg()
| Method Detail |
|---|
public String getColumnName()
public void setColumnName(String columnName)
public Object getValue()
throws SQLException
SQLExceptionpublic void setValue(Object value)
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||