Inherits from NSObject
Declared in DBRecord.h

Overview

A record represents an entry in a particular table and datastore. A record has a unique ID, and contains a set of fields, each of which has a name and a value. You can get records from a object.

Fields can hold values of the following types: NSNumber, NSString, NSData, NSDate, NSArray. For objects of type NSNumber, the value of objCType is not guaranteed to be preserved, but the datastore will distinguish been boolean, integer, and floating-point values. When you get a field that has a list value, its type will be DBList, which allows you to perform conflict-free list mutations.

Changes to this record are immediately visible to other record objects with the same tableId and recordId Calling [DBDatastore sync:], which incorporates remote changes into your datastore, will also update any records you have a reference to.

Tasks

  • + isValidId:

    Returns YES if recordId is a valid ID for a DBRecord, or NO otherwise. IDs are case-sensitive, can be 1-64 characters long and may contain alphanumeric characters plus these punctuation characters: . - _ + / = IDs with a leading : are valid, but reserved for internal use. (Note that older SDKs limited these to 32 characters, so take care if your datastore needs to be accessed by legacy clients.)

  • + isValidFieldName:

    Returns YES if name is a valid name for a field in a DBRecord, or NO otherwise. Names are case-sensitive, can be 1-64 characters long and may contain alphanumeric characters plus these punctuation characters: . - _ + / = Names with a leading : are valid, but reserved for internal use. (Note that older SDKs limited these to 32 characters, so take care if your datastore needs to be accessed by legacy clients.)

  •   recordId

    The id of the record.

    property
  •   table

    The table that contains this record.

    property
  •   fields

    The fields of this record.

    property
  •   size

    The size of this record in bytes. The size of a record is calculated by summing the size of all values in all fields, plus the base size of an empty record itself.

    property
  • – objectForKey:

    Get the value of a single field.

  • – objectForKeyedSubscript:
  • – getOrCreateList:

    Returns the current list at the given field, or returns an empty list if no value is set. If the field has a non-list value, this method will raise an exception.

  • – update:

    Update all the fields in the provided dictionary with the values that they map to.

  • – setObject:forKey:

    Update a single field with the provided value. The value must be non-nil.

  • – setObject:forKeyedSubscript:
  • – removeObjectForKey:

    Remove a single field from the record.

  • – deleteRecord

    Delete this record. This method has no effect on records which have already been deleted.

  •   deleted

    Whether this record is deleted. A deleted DBRecord can’t be used to read or write fields.

    property

Properties

deleted

@property (nonatomic, readonly, getter=isDeleted) BOOL deleted
Discussion

Whether this record is deleted. A deleted DBRecord can’t be used to read or write fields.

Declared In

DBRecord.h

fields

@property (nonatomic, readonly) NSDictionary *fields
Discussion

The fields of this record.

Declared In

DBRecord.h

recordId

@property (nonatomic, readonly) NSString *recordId
Discussion

The id of the record.

Declared In

DBRecord.h

size

@property (nonatomic, readonly) NSUInteger size
Discussion

The size of this record in bytes. The size of a record is calculated by summing the size of all values in all fields, plus the base size of an empty record itself.

Declared In

DBRecord.h

table

@property (nonatomic, readonly) DBTable *table
Discussion

The table that contains this record.

Declared In

DBRecord.h

Class Methods

isValidFieldName:

+ (BOOL)isValidFieldName:(NSString *)name
Discussion

Returns YES if name is a valid name for a field in a DBRecord, or NO otherwise. Names are case-sensitive, can be 1-64 characters long and may contain alphanumeric characters plus these punctuation characters: . - _ + / = Names with a leading : are valid, but reserved for internal use. (Note that older SDKs limited these to 32 characters, so take care if your datastore needs to be accessed by legacy clients.)

Declared In

DBRecord.h

isValidId:

+ (BOOL)isValidId:(NSString *)recordId
Discussion

Returns YES if recordId is a valid ID for a DBRecord, or NO otherwise. IDs are case-sensitive, can be 1-64 characters long and may contain alphanumeric characters plus these punctuation characters: . - _ + / = IDs with a leading : are valid, but reserved for internal use. (Note that older SDKs limited these to 32 characters, so take care if your datastore needs to be accessed by legacy clients.)

Declared In

DBRecord.h

Instance Methods

deleteRecord

- (void)deleteRecord
Discussion

Delete this record. This method has no effect on records which have already been deleted.

Declared In

DBRecord.h

getOrCreateList:

- (DBList *)getOrCreateList:(NSString *)fieldName
Discussion

Returns the current list at the given field, or returns an empty list if no value is set. If the field has a non-list value, this method will raise an exception.

Declared In

DBRecord.h

objectForKey:

- (id)objectForKey:(NSString *)key
Discussion

Get the value of a single field.

Declared In

DBRecord.h

objectForKeyedSubscript:

- (id)objectForKeyedSubscript:(id)key

removeObjectForKey:

- (void)removeObjectForKey:(NSString *)fieldName
Discussion

Remove a single field from the record.

Declared In

DBRecord.h

setObject:forKey:

- (void)setObject:(id)obj forKey:(NSString *)fieldName
Discussion

Update a single field with the provided value. The value must be non-nil.

Declared In

DBRecord.h

setObject:forKeyedSubscript:

- (void)setObject:(id)value forKeyedSubscript:(id)key

update:

- (void)update:(NSDictionary *)fieldsToUpdate
Discussion

Update all the fields in the provided dictionary with the values that they map to.

Declared In

DBRecord.h