|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--javatools.db.DbDeleter
A class used to delete records from SQL tables. The constructor is not public. To obtain a DbDeleter call DbTable.deleter(); Example: To delete all the people who are (younger than 18 or older than 80) and whose name is "Fred"...
DbDatabase db = ...;
DbTable people = db.getTable("PEOPLE");
DbDeleter deleter = people.deleter();
deleter.setWhere(people.getColumn("AGE").lessThan(new Integer(18)).or(
people.getColumn("AGE").greaterThan(new Integer(80))).and(
people.getColumn("NAME").equal("FRED"));
int numberOfPeopleDeleted = deleter.execute();
This is equivilent to... DELETE FROM PEOPLE WHERE (AGE < 18 OR AGE > 80 ) AND NAME='Fred'Note the use of equal(), NOT equals().
| Method Summary | |
int |
execute()
Execute this command on the default connection. |
int |
execute(DbConnection dbcon)
Execute this delete command on a specific connection. |
void |
setWhere(DbExpr where)
Set the where condition for this delete operation. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public void setWhere(DbExpr where)
where - The new where value
public int execute(DbConnection dbcon)
throws DbException
dbcon - The connection to the database.
DbException - If something goes wrong.
public int execute()
throws DbException
DbException - Description of Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||