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.

addFieldWithName:    (declared in DADataTable)

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

Parameters:

  • name:

addInternalFieldWithName:    (declared in DADataTable)

- (DAInternalFieldDefinition *) addInternalFieldWithName:(NSString *)fieldName

Parameters:

  • fieldName:

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.

addNewRowWithDataFromArray:inEditMode:    (declared in DADataTable)

- (DADataTableRow *) addNewRowWithDataFromArray:(NSArray *)data inEditMode:(BOOL)editMode

Parameters:

  • data:
  • editMode:

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

addRowToChangedList:    (declared in DADataTable)

- (void) addRowToChangedList:(DADataTableRow *)changedRow

Parameters:

  • changedRow:

addRowToEditedList:    (declared in DADataTable)

- (void) addRowToEditedList:(DADataTableRow *)row

Parameters:

  • row:

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:


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)

@property (readonly) NSArray_DataTableRow *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) 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:


fieldByPosition:    (declared in DADataTable)

- (DAFieldDefinition *) fieldByPosition:(NSUInteger)aPos

Parameters:

  • aPos:

fieldCount    (declared in DADataTable)

@property (readonly) NSInteger fieldCount

fields    (declared in DADataTable)

@property (readonly) NSArray_FieldDefinition *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:

getPersistentFields    (declared in DADataTable)

- (NSArray *) getPersistentFields

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)

- (InstanceType) init

initWithData:offset:name:

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

Parameters:

  • aData:
  • aOffset:
  • aName:

initWithSchemaTable:    (declared in DADataTable)

- (InstanceType) initWithSchemaTable:(DASchemaDataTable *)schemaTable

Parameters:

  • schemaTable:

keyFields    (declared in DADataTable)

@property (readonly) NSArray_FieldDefinition *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)

@property (readonly) NSArray_FieldDefinition *loggedFields

mergeChangesForAllRows    (declared in DADataTable)

- (void) mergeChangesForAllRows

mergeChangesForRow:    (declared in DADataTable)

- (void) mergeChangesForRow:(DADataTableRow *)aRow

Parameters:

  • aRow:

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)

@property (readonly) NSArray_FieldDefinition *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

removeRowFromChangedList:    (declared in DADataTable)

- (void) removeRowFromChangedList:(DADataTableRow *)row

Parameters:

  • row:

removeRowFromEditedList:    (declared in DADataTable)

- (void) removeRowFromEditedList:(DADataTableRow *)row

Parameters:

  • row:

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:

rowChanged:    (declared in DADataTable)

- (void) rowChanged:(DADataTableRow *)row

Parameters:

  • row:

rowChanged:forFieldPosition:    (declared in DADataTable)

- (void) rowChanged:(DADataTableRow *)row forFieldPosition:(NSInteger)fieldPositions

Parameters:

  • row:
  • fieldPositions:

rowClass    (declared in DADataTable)

@property (readonly) Class rowClass

rowCount    (declared in DADataTable)

@property (readonly) NSInteger rowCount

rows    (declared in DADataTable)

@property (readonly) NSArray_DataTableRow *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.

setBusy:    (declared in DADataTable)

- (void) setBusy:(BOOL)value

Parameters:

  • value:

setName:    (declared in DADataTable)

- (void) setName:(NSString *)aName

Parameters:

  • aName:

setRows:    (declared in DADataTable)

- (void) setRows:(NSMutableArray *)newRows

Parameters:

  • newRows:

setupRealFields:    (declared in DADataTable)

- (void) setupRealFields:(NSMutableArray *)aFields

Parameters:

  • aFields:

setupSchemaWithFields:andParams:    (declared in DADataTable)

- (void) setupSchemaWithFields:(NSMutableArray *)aFields andParams:(NSMutableArray *)aParams

Parameters:

  • aFields:
  • aParams:

setValue:forRow:position:    (declared in DADataTable)

- (void) setValue:(id)aValue forRow:(NSUInteger)rowIndex position:(NSUInteger)fieldIndex

Parameters:

  • aValue:
  • rowIndex:
  • fieldIndex:

triggerTableChangedNotification    (declared in DADataTable)

- (void) triggerTableChangedNotification

triggerTableChangedNotificationForField:    (declared in DADataTable)

- (void) triggerTableChangedNotificationForField:(DAFieldDefinition *)field

Parameters:

  • field:

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

validateNewRowData:    (declared in DADataTable)

- (void) validateNewRowData:(NSDictionary *)data

Parameters:

  • data:

valueForRow:position:    (declared in DADataTable)

- (id) valueForRow:(DADataTableRow *)row position:(NSUInteger)fieldIndex

Parameters:

  • row:
  • fieldIndex:

valueForRowAtIndex:position:    (declared in DADataTable)

- (id) valueForRowAtIndex:(NSUInteger)rowIndex position:(NSUInteger)fieldIndex

Parameters:

  • rowIndex:
  • fieldIndex:

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)

@property (readonly) NSArray_DataTableRow *changedRows

fieldCount    (declared in DADataTable)

@property (readonly) NSInteger fieldCount

fields    (declared in DADataTable)

@property (readonly) NSArray_FieldDefinition *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)

@property (readonly) NSArray_FieldDefinition *keyFields

loggedFields    (declared in DADataTable)

@property (readonly) NSArray_FieldDefinition *loggedFields

name    (declared in DADataTable)

Specifies the name of the table.

@property (readonly) NSString *name

realFields    (declared in DADataTable)

@property (readonly) NSArray_FieldDefinition *realFields

rowClass    (declared in DADataTable)

@property (readonly) Class rowClass

rowCount    (declared in DADataTable)

@property (readonly) NSInteger rowCount

rows    (declared in DADataTable)

@property (readonly) NSArray_DataTableRow *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.

addFieldWithName:    (declared in DADataTable)

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

Parameters:

  • name:

addInternalFieldWithName:    (declared in DADataTable)

- (DAInternalFieldDefinition *) addInternalFieldWithName:(NSString *)fieldName

Parameters:

  • fieldName:

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.

addNewRowWithDataFromArray:inEditMode:    (declared in DADataTable)

- (DADataTableRow *) addNewRowWithDataFromArray:(NSArray *)data inEditMode:(BOOL)editMode

Parameters:

  • data:
  • editMode:

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

addRowToChangedList:    (declared in DADataTable)

- (void) addRowToChangedList:(DADataTableRow *)changedRow

Parameters:

  • changedRow:

addRowToEditedList:    (declared in DADataTable)

- (void) addRowToEditedList:(DADataTableRow *)row

Parameters:

  • row:

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:


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) 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:


fieldByPosition:    (declared in DADataTable)

- (DAFieldDefinition *) fieldByPosition:(NSUInteger)aPos

Parameters:

  • aPos:

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:

getPersistentFields    (declared in DADataTable)

- (NSArray *) getPersistentFields

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)

- (InstanceType) init

initWithData:offset:name:

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

Parameters:

  • aData:
  • aOffset:
  • aName:

initWithSchemaTable:    (declared in DADataTable)

- (InstanceType) initWithSchemaTable:(DASchemaDataTable *)schemaTable

Parameters:

  • schemaTable:

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

mergeChangesForAllRows    (declared in DADataTable)

- (void) mergeChangesForAllRows

mergeChangesForRow:    (declared in DADataTable)

- (void) mergeChangesForRow:(DADataTableRow *)aRow

Parameters:

  • aRow:

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

removeRowFromChangedList:    (declared in DADataTable)

- (void) removeRowFromChangedList:(DADataTableRow *)row

Parameters:

  • row:

removeRowFromEditedList:    (declared in DADataTable)

- (void) removeRowFromEditedList:(DADataTableRow *)row

Parameters:

  • row:

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:

rowChanged:    (declared in DADataTable)

- (void) rowChanged:(DADataTableRow *)row

Parameters:

  • row:

rowChanged:forFieldPosition:    (declared in DADataTable)

- (void) rowChanged:(DADataTableRow *)row forFieldPosition:(NSInteger)fieldPositions

Parameters:

  • row:
  • fieldPositions:

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.

setBusy:    (declared in DADataTable)

- (void) setBusy:(BOOL)value

Parameters:

  • value:

setName:    (declared in DADataTable)

- (void) setName:(NSString *)aName

Parameters:

  • aName:

setRows:    (declared in DADataTable)

- (void) setRows:(NSMutableArray *)newRows

Parameters:

  • newRows:

setupRealFields:    (declared in DADataTable)

- (void) setupRealFields:(NSMutableArray *)aFields

Parameters:

  • aFields:

setupSchemaWithFields:andParams:    (declared in DADataTable)

- (void) setupSchemaWithFields:(NSMutableArray *)aFields andParams:(NSMutableArray *)aParams

Parameters:

  • aFields:
  • aParams:

setValue:forRow:position:    (declared in DADataTable)

- (void) setValue:(id)aValue forRow:(NSUInteger)rowIndex position:(NSUInteger)fieldIndex

Parameters:

  • aValue:
  • rowIndex:
  • fieldIndex:

triggerTableChangedNotification    (declared in DADataTable)

- (void) triggerTableChangedNotification

triggerTableChangedNotificationForField:    (declared in DADataTable)

- (void) triggerTableChangedNotificationForField:(DAFieldDefinition *)field

Parameters:

  • field:

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

validateNewRowData:    (declared in DADataTable)

- (void) validateNewRowData:(NSDictionary *)data

Parameters:

  • data:

valueForRow:position:    (declared in DADataTable)

- (id) valueForRow:(DADataTableRow *)row position:(NSUInteger)fieldIndex

Parameters:

  • row:
  • fieldIndex:

valueForRowAtIndex:position:    (declared in DADataTable)

- (id) valueForRowAtIndex:(NSUInteger)rowIndex position:(NSUInteger)fieldIndex

Parameters:

  • rowIndex:
  • fieldIndex:

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.