ORDATable Protocol Reference
| Conforms to | ORDAResult |
| Declared in | ORDATable.h |
Overview
The ORDATable protocol specifies methods that can be used to manage and retrieve results from a database table. Each table maintains a dictionary of result row objects (those returned by [ORDATableResult objectAtIndexedSubscript:]) indexed by ID (for example, rowid in the SQLite implementation) such that, for any given ID, the same pointer will always be returned. This dictionary is an instance of NSMutableDictionary_NonRetaining_Zeroing – thus, when there are no other references to the row object besides the dictionary’s, the object is removed from the dictionary and deallocated. Each row object is syncrhonized with the database such that changing the database changes the object and vice versa.
Tasks
-
– columnNamesthe associated table’s field names
required method -
– primaryKeyNamesthe associated table’s primary key’s names
required method -
– foreignKeyTableNamesthe associated table’s foreign key’s names
required method -
– selectWhere:Selects from the table
required method -
– insertValues:Inserts values into the table
required method -
– updateSet:to:where:Updates a row in the table
required method
Instance Methods
columnNames
the associated table’s field names
- (NSArray *)columnNamesReturn Value
the associated table’s field names
Declared In
ORDATable.hforeignKeyTableNames
the associated table’s foreign key’s names
- (NSArray *)foreignKeyTableNamesReturn Value
the associated table’s foreign key’s names
Declared In
ORDATable.hinsertValues:
Inserts values into the table
- (id<ORDATableResult>)insertValues:(id)valuesParameters
- values
an object containing the values
Return Value
the inserted row
Discussion
This method performs ‘INSERT INTO
Warning: There is currently no way to insert only some columns.
Declared In
ORDATable.hprimaryKeyNames
the associated table’s primary key’s names
- (NSArray *)primaryKeyNamesReturn Value
the associated table’s primary key’s names
Declared In
ORDATable.hselectWhere:
Selects from the table
- (id<ORDATableResult>)selectWhere:(NSString *)format, ...Parameters
- format
the format string for the where clause
- ...
the format string arguments
Return Value
the selected rows
Discussion
This method runs ‘SELECT * FROM
See Also
[NSString stringWithFormat:]
Declared In
ORDATable.hupdateSet:to:where:
Updates a row in the table
- (id<ORDATableResult>)updateSet:(NSString *)column to:(id)value where:(NSString *)format, ...Parameters
- column
the field to update
- value
the value to set the field to
- format
the format string for the where clause
- ...
the format string arguments
Return Value
the updated rows
Discussion
This method runs ‘UPDATE
Declared In
ORDATable.h