DABin2ReadOnlyDataTable

Overview

The DABin2ReadOnlyDataTable class, which is inherited from DADataTable, represents read-only data tables. It allows to read data to a table directly from the bytes buffer, without involving DABin2DataStreamer.

Please note that this class is deprecated and we only keep it for compatibility with previous versions of DA Xcode. You should not use this class directly and work with the plain DADataTable class instead.

Location

 

addCalculatedField:    (declared in DADataTable)

Adds a new calculated field to the table. Please refer to the documentation for DACalculatedFieldDefinition for more details.

- (void) addCalculatedField:(DACalculatedFieldDefinition *)field

Parameters:


addCalculatedFieldName:dataType:target:selector:    (declared in DADataTable)

Creates and adds a new calculated field to the table. Please refer to the documentation of DACalculatedFieldDefinition for more details.

- (DACalculatedFieldDefinition *) addCalculatedFieldName:(NSString *)name dataType:(enum DADataType)dataType target:(id)target selector:(SEL)selector

Parameters:

  • name: The unique name for the new calculated field.
  • dataType: The DADataType of the calculated field.
  • target: Reference to the object that will provide the method for calculating this field.
  • selector: Selector of method on the target that will calculate the field.

addCalculatedFieldName:dataType:target:selector:cached:    (declared in DADataTable)

Adds a new usual or cached calculated field to the table. Please refer to the documentation for DACalculatedFieldDefinition for more details.

- (DACalculatedFieldDefinition *) addCalculatedFieldName:(NSString *)fieldName dataType:(enum DADataType)dataType target:(id)target selector:(SEL)selector cached:(BOOL)cached

Parameters:

  • fieldName: The unique name for the new calculated field.
  • dataType: The DADataType of the calculated field.
  • target: Reference to the object that will provide the method for calculating this field.
  • selector: Selector of method on the target that will calculate the field.
  • cached: Boolean flag. If YES then new cached calculated field will be added to the table. Please refer to the documentation for DACachedCalculatedFieldDefinition for more details.

addLookupField:    (declared in DADataTable)

Adds lookup field definition to the table. Please refer to the documentation for DALookupFieldDefinition for more details.

- (void) addLookupField:(DALookupFieldDefinition *)field

Parameters:


addLookupFieldName:sourceField:lookupTable:lookupKeyField:lookupResultField:    (declared in DADataTable)

Creates and appends a lookup field to the table. Please refer to the documentation for DALookupFieldDefinition for more details.

- (DALookupFieldDefinition *) addLookupFieldName:(NSString *)name sourceField:(DAFieldDefinition *)sourceField lookupTable:(DADataTable *)lookupTable lookupKeyField:(DAFieldDefinition *)lookupKeyField lookupResultField:(DAFieldDefinition *)lookupResultField

Parameters:

  • name: The unique name for the new calculated field.
  • sourceField: Initializes the sourceField property.
  • lookupTable: Initializes the lookupTable property.
  • lookupKeyField: Initializes the lookupKeyField property.
  • lookupResultField: Initializes the lookupResultField property.

addNewRow    (declared in DADataTable)

Appends a new row to the table. If the row has any AutoInc columns, new negative ID values will be generated automatically for these. All other columns will be initialized as null. A reference to the newly added row will be returned to the caller.

This method triggers the 'TableChanged' notification for the DADataTable.

- (DADataTableRow *) addNewRow

addNewRowInEditMode:    (declared in DADataTable)

Adds a new row for the table.

- (DADataTableRow *) addNewRowInEditMode:(BOOL)editMode

Parameters:

  • editMode: When YES then new row will be added in edit mode. Edit mode is different from the usual mode so that all changes are not visible for the table until they will be fixed by post method or cancelled by discard method.

addNewRowWithDataFromDictionary:inEditMode:    (declared in DADataTable)

method which allows adding new row with the data from the dictionary in one go. If your table has an autoincrement key field then just omit passing its temporary value in the dictionary. It will be generated automatically by library (otherwize it will throw an exception saying that you cannot specify custom value for autoincrement field.) Also, you don’t need to pass values for ALL fields. You can specify there only ones you need. It also can be quite convenient for setting default values for the row.

- (DADataTableRow *) addNewRowWithDataFromDictionary:(NSDictionary *)data inEditMode:(BOOL)editMode

Parameters:

  • data: Dictionary with data for new row
  • editMode: boolean flag which specify do we create new row in EditMode or not

appendTable:    (declared in DADataTable)

Appends all rows from given table. Finally fires DA_NOTIFICATION_TABLE_CHANGED and DA_NOTIFICATION_TABLE_INDEX_MUST_UPDATE events.

- (void) appendTable:(DADataTable *)newTable

Parameters:

  • newTable: table whose rows will be appended to the current table.

buildIndexForField:    (declared in DADataTable)

Creates a new DAIndex for the specified field, if none was created before, and returns a reference to the caller. In contrast to indexForField:, the created index will be persisted for future use. It can be removed later, for example to conserve memory, by calling dropIndexForField:.

- (DAIndex *) buildIndexForField:(NSString *)indexField

Parameters:

  • indexField: Name of the field in given %DADataTable% for which we want to build DAIndex

busy    (declared in DADataTable)

Boolean flag, when it is YES then whole table is in busy mode and any changes can be done here. This usually happens when a table is serialized into a briefcase or creates a delta with changes based on current data table.

@property (readonly) BOOL busy

cancelAllChanges    (declared in DADataTable)

Cancels all changes in the table. Each row in [table changedRows] will be sent a cancelChangesForRow message.

- (void) cancelAllChanges

cancelChangeForRow:    (declared in DADataTable)

Cancels changes for given row. If row was added then this method will remove it. If row was deleted then this method will restore it.

- (void) cancelChangeForRow:(DADataTableRow *)row

Parameters:

  • row: Row which changes should be canceled.

cancelChangesForRow:    (declared in DADataTable)

Cancels changes in a specified row. Deprecated, please use cancelChangeForRow: method instead.

- (void) cancelChangesForRow:(DADataTableRow *)row

Parameters:


changedRows    (declared in DADataTable)

Returns an array with the subset DADataTableRows in the table that contain pending changes.

@property (readonly) NSArray *changedRows

defaultPredicateEditorRowTemplates    (declared in DADataTable)

Returns a set of default NSPredicateEditorRowTemplates that can be used to let the user define a custom filter based on the fields in the table. Lookup fields will be handled automatically by these templates, to provide popup buttons for all valid lookup values. See also Working with NSPredicateEditor (Xcode (Mac)) and the Filters sample.

- (NSArray *) defaultPredicateEditorRowTemplates

discardAll    (declared in DADataTable)

This method discards all changes for the table that was made in edit mode and restores the original values. Finally method turns off edit mode for rows in the table.

- (void) discardAll

dropIndexForField:    (declared in DADataTable)

Removes an index that was previously created through buildIndexForField:.

- (void) dropIndexForField:(NSString *)indexField

Parameters:

  • indexField:

fieldByName:    (declared in DADataTable)

Returns the DAFieldDefinition for the field with the given name.

- (DAFieldDefinition *) fieldByName:(NSString *)name

Parameters:


fieldCount    (declared in DADataTable)

Returns the count of all fields defined in the table.

@property (readonly) NSUInteger fieldCount

fields    (declared in DADataTable)

Returns an array of all fields (DAFieldDefinition) in the table.

@property (readonly) NSArray *fields

filterUsingPredicate:    (declared in DADataTable)

Applies a predicate condition to filter the rows in the table. In contrast to rowsFilteredUsingPredicate*, which returns a new filtered array of rows, this method will filter the actual list of rows in the table; all rows not matching the predicate will be discarded from the DADataTable, any pending changes in those rows will be lost.

Use this method if you want to permanently reduce the number of rows maintained by your client application. Use rowsFilteredUsingPredicate*, instead, if you merely want to temporarily work with a reduced subset of the rows, for example for display in a view.

This method triggers the 'TableChanged' notification for the DADataTable.

- (void) filterUsingPredicate:(NSPredicate *)predicate

Parameters:

  • predicate:

getRowWithData:    (declared in DADataTable)

Builds and returns DADataTableRow instance from given array of the values.

- (DADataTableRow *) getRowWithData:(NSArray *)data

Parameters:

  • data: array of the data for new row.

hasChanges    (declared in DADataTable)

Returns whether the table contains any rows with open changes (YES) or not (NO). This is equivalent to [changedRows count] > 0.

@property (readonly) BOOL hasChanges

indexForField:    (declared in DADataTable)

Returns a DAIndex for the specified field. If no index was created before by calling buildIndexForField:, a new index will be created and returned; this newly created index will not be cached for future use.

Use this method to create and obtain a temporary index that can be discarded after use, or to obtain an index previously created through buildIndexForField:.

- (DAIndex *) indexForField:(NSString *)indexField

Parameters:

  • indexField: Name of the field for which we are obtaining index

init    (declared in DADataTable)

Method initializes new instance of the DADataTable

- (id) init

initWithData:offset:name:

Initializes the table with the given bytes buffer. Besides the buffer we can also specify the offset from where we want to start reading, as well as the name for our table.

- (id) initWithData:(NSData *)aData offset:(int)aOffset name:(NSString *)aName

Parameters:

  • aData: Bytes buffer that holds the table data we want to read in Bin2 format.
  • aOffset: Offset in the bytes buffer from where we want to start reading.
  • aName: Name for the given table. This name can be different from the table name encoded in the bytes buffer we read.

initWithSchemaTable:    (declared in DADataTable)

Method initializes new instance of the DADataTable from the given SchemaDataTable. Using this method you can easily setup your DataTable without requesting data.

- (id) initWithSchemaTable:(DASchemaDataTable *)schemaTable

Parameters:

  • schemaTable: Instance of the Schema DataTable

keyFields    (declared in DADataTable)

Returns an array of primary key (PK) fields (DAFieldDefinition) defined for the table.

@property (readonly) NSArray *keyFields

lock    (declared in DADataTable)

Locks the table to avoid triggering 'TableChanged' notifications. This can be helpful when a lot of changes will be made to the table at once, but observers that track changes are listening to 'TableChanged' notifications. If data was changed while the table was in locked state, a single 'TableChanged' notification will be fired after the table is unlocked.

- (void) lock

loggedFields    (declared in DADataTable)

Returns an array of logged and PK fields (DAFieldDefinition) defined for the table.

@property (readonly) NSArray *loggedFields

mergeTable:withPrimaryKey:    (declared in DADataTable)

Updates the current table with data from the passed, based on a single primary key (PK) field. By comparing values for the key field, the method tries to locate the same row in the destination table and replace it, if found. If not found, the row will be added as new to the destination table. This method does not delete any rows.

It is assumed that both tables have the same structure.

- (void) mergeTable:(DADataTable *)newTable withPrimaryKey:(NSString *)PK

Parameters:

  • newTable: The DADataTable to merge into the current table.
  • PK: primary keys column name.

mergeTable:withPrimaryKeys:    (declared in DADataTable)

Updates the current table with data from the passed, based on a list of several primary key (PK) fields. By comparing values for the key fields, the method tries to locate the same row in the destination table and replace it, if found. If not found, the row will be added as new to the destination table. This method does not delete any rows.

It is assumed that both tables have the same structure structure.

- (void) mergeTable:(DADataTable *)newTable withPrimaryKeys:(NSArray *)PKs

Parameters:

  • newTable: The DADataTable to merge into the current table.
  • PKs: Array of primary keys column names.

name    (declared in DADataTable)

Specifies the name of the table.

@property (readonly) NSString *name

postAll    (declared in DADataTable)

Confirms and fixes all changes in the table made in edit mode

- (void) postAll

predicateEditorRowTemplatesForFieldName:    (declared in DADataTable)

Returns a set of default NSPredicateEditorRowTemplates that can be used to let the user define a custom filter based on a single field in the table. See also defaultPredicateEditorRowTemplates.

- (NSArray *) predicateEditorRowTemplatesForFieldName:(NSString *)field

Parameters:

  • field: Field name for which we are getting templates

processDelta:andMergeChanges:    (declared in DADataTable)

Method merges the changes from given delta with the table.

- (void) processDelta:(DADelta *)delta andMergeChanges:(BOOL)applyChanges

Parameters:

  • delta: delta with changes we need to merge into the table
  • applyChanges: boolean flag, if YES then changes will be committed in the table (i.e. table will not have pending changes)

realFields    (declared in DADataTable)

Returns an array of real fields (DAFieldDefinition) in the table.

@property (readonly) NSArray *realFields

registerRowClass:forTableName:    (declared in DADataTable)

+ (void) registerRowClass:(Class)class forTableName:(NSString *)name

Parameters:

  • class:
  • name:

removeRow:    (declared in DADataTable)

Removes a specified row from the table and adds it to changedRows list, so it will be deleted on the server when applying changes.

- (void) removeRow:(DADataTableRow *)row

Parameters:

  • row:

removeRowAtIndex:    (declared in DADataTable)

Removes a row at a specified index from the table and adds it to the changedRows list, so it will be deleted on the server when applying changes.

- (void) removeRowAtIndex:(NSUInteger)index

Parameters:

  • index: index of the row we want to remove

replaceRowsWithDataFromTable:    (declared in DADataTable)

Replaces all rows in the table with all rows from given table.

- (void) replaceRowsWithDataFromTable:(DADataTable *)newTable

Parameters:

  • newTable: source table

rowAtIndex:    (declared in DADataTable)

- (DADataTableRow *) rowAtIndex:(NSInteger)aRow

Parameters:

  • aRow:

rowClass    (declared in DADataTable)

@property (readonly) Class rowClass

rowCount    (declared in DADataTable)

Returns the count of all rows in the table.

@property (readonly) NSUInteger rowCount

rows    (declared in DADataTable)

Returns an array of all rows (DADataTableRow) in the table. In contrast to the other row methods, this property will not construct a new array on the fly, but will return the same aray instance that is used internally by the data table to manage rows. User code should not try to make any changes to this array.

@property (readonly) NSArray *rows

rowsFilteredUsingPredicate:    (declared in DADataTable)

Returns a new array with a subset of of rows filtered according to the predicate.

- (NSArray *) rowsFilteredUsingPredicate:(NSPredicate *)predicate

Parameters:

  • predicate: Predicate to use for filtering.

rowsFilteredUsingPredicate:localizedCaseInsensitivelySortedByField:ascending:    (declared in DADataTable)

Returns a new array with a subset of of rows filtered according to the predicate and also sorted by given field using localizedCaseInsensitiveCompare: selector.

- (NSArray *) rowsFilteredUsingPredicate:(NSPredicate *)predicate localizedCaseInsensitivelySortedByField:(NSString *)sortField ascending:(BOOL)ascending

Parameters:

  • predicate: Predicate to use for filtering.
  • sortField: Name of the field for sorting result set.
  • ascending: Boolean flag specifies sorting mode.

rowsFilteredUsingPredicate:sortedByField:ascending:    (declared in DADataTable)

Returns a new array with a subset of of rows filtered according to the predicate, and also sorted by the specified field.

- (NSArray *) rowsFilteredUsingPredicate:(NSPredicate *)predicate sortedByField:(NSString *)sortField ascending:(BOOL)ascending

Parameters:

  • predicate: Predicate to use for filtering.
  • sortField: FieldName to use for sorting.
  • ascending: YES if ascending and NO if descending.

rowsFinderStyleSortedByField:ascending:    (declared in DADataTable)

Method returns a new array that lists rows sorted by given field in "Finder style". "Finder style" here means case insencetive with proper strings and numbers comparison - like in OS X Finder application.

- (NSArray *) rowsFinderStyleSortedByField:(NSString *)sortField ascending:(BOOL)ascending

Parameters:

  • sortField: Name of the field that should be used for sorting
  • ascending: Boolean flag, when YES then result array will be sorted in ascending way. When NO then in descending way.

rowsLocalizedCaseInsensitivelySortedByField:ascending:    (declared in DADataTable)

Method returns a new array that lists rows sorted by given field in the localized case insensetive way.

- (NSArray *) rowsLocalizedCaseInsensitivelySortedByField:(NSString *)sortField ascending:(BOOL)ascending

Parameters:

  • sortField: Name of the field that should be used for sorting
  • ascending: Boolean flag, when YES then result array will be sorted in ascending way. When NO then in descending way.

rowsPartitionedByField:    (declared in DADataTable)

Returns a dictionary with rows where dictionary key is the value of the given field.

- (NSDictionary *) rowsPartitionedByField:(NSString *)fieldName

Parameters:

  • fieldName: name of the grouping field.

rowsPartitionedByField:includeNull:    (declared in DADataTable)

Returns a dictionary with rows where dictionary key is the value of the given field.

- (NSDictionary *) rowsPartitionedByField:(NSString *)fieldName includeNull:(BOOL)includeNull

Parameters:

  • fieldName: Name of the field on which we need to group rows
  • includeNull: If YES then for Null values it creates null value group

rowsPartitionedByField:includeNull:sortedByField:ascending:    (declared in DADataTable)

Returns a dictionary with rows grouped by values of given field. Where grouping value is the key of the dictonary.

- (NSDictionary *) rowsPartitionedByField:(NSString *)fieldName includeNull:(BOOL)includeNull sortedByField:(NSString *)sortfield ascending:(BOOL)ascending

Parameters:

  • fieldName: Name of the field on which we need to group rows
  • includeNull: If YES then it creates null value group for Null values of given field
  • sortfield: Name of the field on which we want to sort result rows
  • ascending: Boolean flag, when YES then grouped rows in dictionary will be sorted in ascending way. When NO then in descending way.

rowsSortedByField:ascending:    (declared in DADataTable)

Returns a new array with all rows in the table, sorted by the specified field.

- (NSArray *) rowsSortedByField:(NSString *)sortField ascending:(BOOL)ascending

Parameters:

  • sortField: Name of the field on which we want to sort result rows
  • ascending: Boolean flag, when YES then grouped rows in dictionary will be sorted in ascending way. When NO then in descending way.

unlock    (declared in DADataTable)

Unlocks the table to allow triggering 'TableChanged' notifications. If data was changed while the table was in locked state, a single 'TableChanged' notification will be fired when the table gets unlocked.

- (void) unlock

useFullDelta  assign    (declared in DADataTable)

@property (assign) BOOL useFullDelta

writeToData:

This method serializes all table data including the schema into the bytes buffer using Bin2 format.

- (void) writeToData:(NSMutableData *)aData

Parameters:

  • aData: Instance of the bytes buffer where we want to serialize data.

 

busy    (declared in DADataTable)

Boolean flag, when it is YES then whole table is in busy mode and any changes can be done here. This usually happens when a table is serialized into a briefcase or creates a delta with changes based on current data table.

@property (readonly) BOOL busy

changedRows    (declared in DADataTable)

Returns an array with the subset DADataTableRows in the table that contain pending changes.

@property (readonly) NSArray *changedRows

fieldCount    (declared in DADataTable)

Returns the count of all fields defined in the table.

@property (readonly) NSUInteger fieldCount

fields    (declared in DADataTable)

Returns an array of all fields (DAFieldDefinition) in the table.

@property (readonly) NSArray *fields

hasChanges    (declared in DADataTable)

Returns whether the table contains any rows with open changes (YES) or not (NO). This is equivalent to [changedRows count] > 0.

@property (readonly) BOOL hasChanges

keyFields    (declared in DADataTable)

Returns an array of primary key (PK) fields (DAFieldDefinition) defined for the table.

@property (readonly) NSArray *keyFields

loggedFields    (declared in DADataTable)

Returns an array of logged and PK fields (DAFieldDefinition) defined for the table.

@property (readonly) NSArray *loggedFields

name    (declared in DADataTable)

Specifies the name of the table.

@property (readonly) NSString *name

realFields    (declared in DADataTable)

Returns an array of real fields (DAFieldDefinition) in the table.

@property (readonly) NSArray *realFields

rowClass    (declared in DADataTable)

@property (readonly) Class rowClass

rowCount    (declared in DADataTable)

Returns the count of all rows in the table.

@property (readonly) NSUInteger rowCount

rows    (declared in DADataTable)

Returns an array of all rows (DADataTableRow) in the table. In contrast to the other row methods, this property will not construct a new array on the fly, but will return the same aray instance that is used internally by the data table to manage rows. User code should not try to make any changes to this array.

@property (readonly) NSArray *rows

useFullDelta  assign    (declared in DADataTable)

@property (assign) BOOL useFullDelta

 

registerRowClass:forTableName:    (declared in DADataTable)

+ (void) registerRowClass:(Class)class forTableName:(NSString *)name

Parameters:

  • class:
  • name:

 

addCalculatedField:    (declared in DADataTable)

Adds a new calculated field to the table. Please refer to the documentation for DACalculatedFieldDefinition for more details.

- (void) addCalculatedField:(DACalculatedFieldDefinition *)field

Parameters:


addCalculatedFieldName:dataType:target:selector:    (declared in DADataTable)

Creates and adds a new calculated field to the table. Please refer to the documentation of DACalculatedFieldDefinition for more details.

- (DACalculatedFieldDefinition *) addCalculatedFieldName:(NSString *)name dataType:(enum DADataType)dataType target:(id)target selector:(SEL)selector

Parameters:

  • name: The unique name for the new calculated field.
  • dataType: The DADataType of the calculated field.
  • target: Reference to the object that will provide the method for calculating this field.
  • selector: Selector of method on the target that will calculate the field.

addCalculatedFieldName:dataType:target:selector:cached:    (declared in DADataTable)

Adds a new usual or cached calculated field to the table. Please refer to the documentation for DACalculatedFieldDefinition for more details.

- (DACalculatedFieldDefinition *) addCalculatedFieldName:(NSString *)fieldName dataType:(enum DADataType)dataType target:(id)target selector:(SEL)selector cached:(BOOL)cached

Parameters:

  • fieldName: The unique name for the new calculated field.
  • dataType: The DADataType of the calculated field.
  • target: Reference to the object that will provide the method for calculating this field.
  • selector: Selector of method on the target that will calculate the field.
  • cached: Boolean flag. If YES then new cached calculated field will be added to the table. Please refer to the documentation for DACachedCalculatedFieldDefinition for more details.

addLookupField:    (declared in DADataTable)

Adds lookup field definition to the table. Please refer to the documentation for DALookupFieldDefinition for more details.

- (void) addLookupField:(DALookupFieldDefinition *)field

Parameters:


addLookupFieldName:sourceField:lookupTable:lookupKeyField:lookupResultField:    (declared in DADataTable)

Creates and appends a lookup field to the table. Please refer to the documentation for DALookupFieldDefinition for more details.

- (DALookupFieldDefinition *) addLookupFieldName:(NSString *)name sourceField:(DAFieldDefinition *)sourceField lookupTable:(DADataTable *)lookupTable lookupKeyField:(DAFieldDefinition *)lookupKeyField lookupResultField:(DAFieldDefinition *)lookupResultField

Parameters:

  • name: The unique name for the new calculated field.
  • sourceField: Initializes the sourceField property.
  • lookupTable: Initializes the lookupTable property.
  • lookupKeyField: Initializes the lookupKeyField property.
  • lookupResultField: Initializes the lookupResultField property.

addNewRow    (declared in DADataTable)

Appends a new row to the table. If the row has any AutoInc columns, new negative ID values will be generated automatically for these. All other columns will be initialized as null. A reference to the newly added row will be returned to the caller.

This method triggers the 'TableChanged' notification for the DADataTable.

- (DADataTableRow *) addNewRow

addNewRowInEditMode:    (declared in DADataTable)

Adds a new row for the table.

- (DADataTableRow *) addNewRowInEditMode:(BOOL)editMode

Parameters:

  • editMode: When YES then new row will be added in edit mode. Edit mode is different from the usual mode so that all changes are not visible for the table until they will be fixed by post method or cancelled by discard method.

addNewRowWithDataFromDictionary:inEditMode:    (declared in DADataTable)

method which allows adding new row with the data from the dictionary in one go. If your table has an autoincrement key field then just omit passing its temporary value in the dictionary. It will be generated automatically by library (otherwize it will throw an exception saying that you cannot specify custom value for autoincrement field.) Also, you don’t need to pass values for ALL fields. You can specify there only ones you need. It also can be quite convenient for setting default values for the row.

- (DADataTableRow *) addNewRowWithDataFromDictionary:(NSDictionary *)data inEditMode:(BOOL)editMode

Parameters:

  • data: Dictionary with data for new row
  • editMode: boolean flag which specify do we create new row in EditMode or not

appendTable:    (declared in DADataTable)

Appends all rows from given table. Finally fires DA_NOTIFICATION_TABLE_CHANGED and DA_NOTIFICATION_TABLE_INDEX_MUST_UPDATE events.

- (void) appendTable:(DADataTable *)newTable

Parameters:

  • newTable: table whose rows will be appended to the current table.

buildIndexForField:    (declared in DADataTable)

Creates a new DAIndex for the specified field, if none was created before, and returns a reference to the caller. In contrast to indexForField:, the created index will be persisted for future use. It can be removed later, for example to conserve memory, by calling dropIndexForField:.

- (DAIndex *) buildIndexForField:(NSString *)indexField

Parameters:

  • indexField: Name of the field in given %DADataTable% for which we want to build DAIndex

cancelAllChanges    (declared in DADataTable)

Cancels all changes in the table. Each row in [table changedRows] will be sent a cancelChangesForRow message.

- (void) cancelAllChanges

cancelChangeForRow:    (declared in DADataTable)

Cancels changes for given row. If row was added then this method will remove it. If row was deleted then this method will restore it.

- (void) cancelChangeForRow:(DADataTableRow *)row

Parameters:

  • row: Row which changes should be canceled.

cancelChangesForRow:    (declared in DADataTable)

Cancels changes in a specified row. Deprecated, please use cancelChangeForRow: method instead.

- (void) cancelChangesForRow:(DADataTableRow *)row

Parameters:


defaultPredicateEditorRowTemplates    (declared in DADataTable)

Returns a set of default NSPredicateEditorRowTemplates that can be used to let the user define a custom filter based on the fields in the table. Lookup fields will be handled automatically by these templates, to provide popup buttons for all valid lookup values. See also Working with NSPredicateEditor (Xcode (Mac)) and the Filters sample.

- (NSArray *) defaultPredicateEditorRowTemplates

discardAll    (declared in DADataTable)

This method discards all changes for the table that was made in edit mode and restores the original values. Finally method turns off edit mode for rows in the table.

- (void) discardAll

dropIndexForField:    (declared in DADataTable)

Removes an index that was previously created through buildIndexForField:.

- (void) dropIndexForField:(NSString *)indexField

Parameters:

  • indexField:

fieldByName:    (declared in DADataTable)

Returns the DAFieldDefinition for the field with the given name.

- (DAFieldDefinition *) fieldByName:(NSString *)name

Parameters:


filterUsingPredicate:    (declared in DADataTable)

Applies a predicate condition to filter the rows in the table. In contrast to rowsFilteredUsingPredicate*, which returns a new filtered array of rows, this method will filter the actual list of rows in the table; all rows not matching the predicate will be discarded from the DADataTable, any pending changes in those rows will be lost.

Use this method if you want to permanently reduce the number of rows maintained by your client application. Use rowsFilteredUsingPredicate*, instead, if you merely want to temporarily work with a reduced subset of the rows, for example for display in a view.

This method triggers the 'TableChanged' notification for the DADataTable.

- (void) filterUsingPredicate:(NSPredicate *)predicate

Parameters:

  • predicate:

getRowWithData:    (declared in DADataTable)

Builds and returns DADataTableRow instance from given array of the values.

- (DADataTableRow *) getRowWithData:(NSArray *)data

Parameters:

  • data: array of the data for new row.

indexForField:    (declared in DADataTable)

Returns a DAIndex for the specified field. If no index was created before by calling buildIndexForField:, a new index will be created and returned; this newly created index will not be cached for future use.

Use this method to create and obtain a temporary index that can be discarded after use, or to obtain an index previously created through buildIndexForField:.

- (DAIndex *) indexForField:(NSString *)indexField

Parameters:

  • indexField: Name of the field for which we are obtaining index

init    (declared in DADataTable)

Method initializes new instance of the DADataTable

- (id) init

initWithData:offset:name:

Initializes the table with the given bytes buffer. Besides the buffer we can also specify the offset from where we want to start reading, as well as the name for our table.

- (id) initWithData:(NSData *)aData offset:(int)aOffset name:(NSString *)aName

Parameters:

  • aData: Bytes buffer that holds the table data we want to read in Bin2 format.
  • aOffset: Offset in the bytes buffer from where we want to start reading.
  • aName: Name for the given table. This name can be different from the table name encoded in the bytes buffer we read.

initWithSchemaTable:    (declared in DADataTable)

Method initializes new instance of the DADataTable from the given SchemaDataTable. Using this method you can easily setup your DataTable without requesting data.

- (id) initWithSchemaTable:(DASchemaDataTable *)schemaTable

Parameters:

  • schemaTable: Instance of the Schema DataTable

lock    (declared in DADataTable)

Locks the table to avoid triggering 'TableChanged' notifications. This can be helpful when a lot of changes will be made to the table at once, but observers that track changes are listening to 'TableChanged' notifications. If data was changed while the table was in locked state, a single 'TableChanged' notification will be fired after the table is unlocked.

- (void) lock

mergeTable:withPrimaryKey:    (declared in DADataTable)

Updates the current table with data from the passed, based on a single primary key (PK) field. By comparing values for the key field, the method tries to locate the same row in the destination table and replace it, if found. If not found, the row will be added as new to the destination table. This method does not delete any rows.

It is assumed that both tables have the same structure.

- (void) mergeTable:(DADataTable *)newTable withPrimaryKey:(NSString *)PK

Parameters:

  • newTable: The DADataTable to merge into the current table.
  • PK: primary keys column name.

mergeTable:withPrimaryKeys:    (declared in DADataTable)

Updates the current table with data from the passed, based on a list of several primary key (PK) fields. By comparing values for the key fields, the method tries to locate the same row in the destination table and replace it, if found. If not found, the row will be added as new to the destination table. This method does not delete any rows.

It is assumed that both tables have the same structure structure.

- (void) mergeTable:(DADataTable *)newTable withPrimaryKeys:(NSArray *)PKs

Parameters:

  • newTable: The DADataTable to merge into the current table.
  • PKs: Array of primary keys column names.

postAll    (declared in DADataTable)

Confirms and fixes all changes in the table made in edit mode

- (void) postAll

predicateEditorRowTemplatesForFieldName:    (declared in DADataTable)

Returns a set of default NSPredicateEditorRowTemplates that can be used to let the user define a custom filter based on a single field in the table. See also defaultPredicateEditorRowTemplates.

- (NSArray *) predicateEditorRowTemplatesForFieldName:(NSString *)field

Parameters:

  • field: Field name for which we are getting templates

processDelta:andMergeChanges:    (declared in DADataTable)

Method merges the changes from given delta with the table.

- (void) processDelta:(DADelta *)delta andMergeChanges:(BOOL)applyChanges

Parameters:

  • delta: delta with changes we need to merge into the table
  • applyChanges: boolean flag, if YES then changes will be committed in the table (i.e. table will not have pending changes)

removeRow:    (declared in DADataTable)

Removes a specified row from the table and adds it to changedRows list, so it will be deleted on the server when applying changes.

- (void) removeRow:(DADataTableRow *)row

Parameters:

  • row:

removeRowAtIndex:    (declared in DADataTable)

Removes a row at a specified index from the table and adds it to the changedRows list, so it will be deleted on the server when applying changes.

- (void) removeRowAtIndex:(NSUInteger)index

Parameters:

  • index: index of the row we want to remove

replaceRowsWithDataFromTable:    (declared in DADataTable)

Replaces all rows in the table with all rows from given table.

- (void) replaceRowsWithDataFromTable:(DADataTable *)newTable

Parameters:

  • newTable: source table

rowAtIndex:    (declared in DADataTable)

- (DADataTableRow *) rowAtIndex:(NSInteger)aRow

Parameters:

  • aRow:

rowsFilteredUsingPredicate:    (declared in DADataTable)

Returns a new array with a subset of of rows filtered according to the predicate.

- (NSArray *) rowsFilteredUsingPredicate:(NSPredicate *)predicate

Parameters:

  • predicate: Predicate to use for filtering.

rowsFilteredUsingPredicate:localizedCaseInsensitivelySortedByField:ascending:    (declared in DADataTable)

Returns a new array with a subset of of rows filtered according to the predicate and also sorted by given field using localizedCaseInsensitiveCompare: selector.

- (NSArray *) rowsFilteredUsingPredicate:(NSPredicate *)predicate localizedCaseInsensitivelySortedByField:(NSString *)sortField ascending:(BOOL)ascending

Parameters:

  • predicate: Predicate to use for filtering.
  • sortField: Name of the field for sorting result set.
  • ascending: Boolean flag specifies sorting mode.

rowsFilteredUsingPredicate:sortedByField:ascending:    (declared in DADataTable)

Returns a new array with a subset of of rows filtered according to the predicate, and also sorted by the specified field.

- (NSArray *) rowsFilteredUsingPredicate:(NSPredicate *)predicate sortedByField:(NSString *)sortField ascending:(BOOL)ascending

Parameters:

  • predicate: Predicate to use for filtering.
  • sortField: FieldName to use for sorting.
  • ascending: YES if ascending and NO if descending.

rowsFinderStyleSortedByField:ascending:    (declared in DADataTable)

Method returns a new array that lists rows sorted by given field in "Finder style". "Finder style" here means case insencetive with proper strings and numbers comparison - like in OS X Finder application.

- (NSArray *) rowsFinderStyleSortedByField:(NSString *)sortField ascending:(BOOL)ascending

Parameters:

  • sortField: Name of the field that should be used for sorting
  • ascending: Boolean flag, when YES then result array will be sorted in ascending way. When NO then in descending way.

rowsLocalizedCaseInsensitivelySortedByField:ascending:    (declared in DADataTable)

Method returns a new array that lists rows sorted by given field in the localized case insensetive way.

- (NSArray *) rowsLocalizedCaseInsensitivelySortedByField:(NSString *)sortField ascending:(BOOL)ascending

Parameters:

  • sortField: Name of the field that should be used for sorting
  • ascending: Boolean flag, when YES then result array will be sorted in ascending way. When NO then in descending way.

rowsPartitionedByField:    (declared in DADataTable)

Returns a dictionary with rows where dictionary key is the value of the given field.

- (NSDictionary *) rowsPartitionedByField:(NSString *)fieldName

Parameters:

  • fieldName: name of the grouping field.

rowsPartitionedByField:includeNull:    (declared in DADataTable)

Returns a dictionary with rows where dictionary key is the value of the given field.

- (NSDictionary *) rowsPartitionedByField:(NSString *)fieldName includeNull:(BOOL)includeNull

Parameters:

  • fieldName: Name of the field on which we need to group rows
  • includeNull: If YES then for Null values it creates null value group

rowsPartitionedByField:includeNull:sortedByField:ascending:    (declared in DADataTable)

Returns a dictionary with rows grouped by values of given field. Where grouping value is the key of the dictonary.

- (NSDictionary *) rowsPartitionedByField:(NSString *)fieldName includeNull:(BOOL)includeNull sortedByField:(NSString *)sortfield ascending:(BOOL)ascending

Parameters:

  • fieldName: Name of the field on which we need to group rows
  • includeNull: If YES then it creates null value group for Null values of given field
  • sortfield: Name of the field on which we want to sort result rows
  • ascending: Boolean flag, when YES then grouped rows in dictionary will be sorted in ascending way. When NO then in descending way.

rowsSortedByField:ascending:    (declared in DADataTable)

Returns a new array with all rows in the table, sorted by the specified field.

- (NSArray *) rowsSortedByField:(NSString *)sortField ascending:(BOOL)ascending

Parameters:

  • sortField: Name of the field on which we want to sort result rows
  • ascending: Boolean flag, when YES then grouped rows in dictionary will be sorted in ascending way. When NO then in descending way.

unlock    (declared in DADataTable)

Unlocks the table to allow triggering 'TableChanged' notifications. If data was changed while the table was in locked state, a single 'TableChanged' notification will be fired when the table gets unlocked.

- (void) unlock

writeToData:

This method serializes all table data including the schema into the bytes buffer using Bin2 format.

- (void) writeToData:(NSMutableData *)aData

Parameters:

  • aData: Instance of the bytes buffer where we want to serialize data.