|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.workingdogs.village.KeyDef
public class KeyDef
A KeyDef is a way to define the key columns in a table. The KeyDef is generally used in conjunction with a TableDataSet. Essentially a KeyDef is what forms the WHERE clause for an UPDATE or DELETE.
In order to use the KeyDef, you simply use it like this:
KeyDef kd = new KeyDef().addAttrib("key_column_a");
TableDataSet tds = new TableDataSet ( connection, "table", kd );
tds.fetchRecords();
Record rec = tds.getRecord(0);
rec.setValue("column_name", "new value" );
rec.save();
tds.close();
In the above example, Record 0 is retrieved from the database table and the following update statement is generated:
UPDATE table SET column_name=? WHERE key_column_a=?
| Constructor Summary | |
|---|---|
KeyDef()
Constructor for KeyDef. |
|
| Method Summary | |
|---|---|
KeyDef |
addAttrib(java.lang.String name)
Adds the named attribute to the KeyDef. |
boolean |
containsAttrib(java.lang.String name)
Determines if the KeyDef contains the requested Attribute. |
java.lang.String |
getAttrib(int pos)
getAttrib is 1 based. |
int |
size()
KeyDef's are 1 based, returns size - 1 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public KeyDef()
| Method Detail |
|---|
public KeyDef addAttrib(java.lang.String name)
name - TODO: DOCUMENT ME!
public boolean containsAttrib(java.lang.String name)
name - TODO: DOCUMENT ME!
public java.lang.String getAttrib(int pos)
pos - TODO: DOCUMENT ME!
public int size()
addAttrib(java.lang.String)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||