Copyright ©1995 by NeXT Computer, Inc.  All Rights Reserved.

DBAssociation



Inherits From: Object
Declared In: dbkit/DBAssociation.h



Class Description

A DBAssociation object connects a provider of data with an object that displays or otherwise uses that data:

The data-provider is called the expression; it's represented by a DBExpression object.
The data-user is the destination.  There are two types of destinations:  user interface objects such as DBTableViews, and DBFetchGroup objects.  The former uses the data by displaying it.  The latter uses the data as the source of a DBRecordList object--in other words, it implements a master

Although the general definition of a DBAssociation is fairly broad, the way that DBAssociations are configured and used by the Database Kit is quite specific.  The rules are as follows:

The expression is   It's either DBAssociation objects are created and owned by DBFetchGroup objects:  A DBFetchGroup automatically creates and configures a DBAssociation for each interface object that it (the DBFetchGroup) manages, so that you never need to create DBAssociation objects directly.  In addition, you should rarely need to create a subclass of DBAssociation.  (However, if you create your own user interface class to display database values, that class will need to implement some of the DBCustomAssociation category methods.)

You retrieve DBAssociation objects through DBModule's associationForObject: method (DBModules manage DBFetchGroups), as explained in the specification for the DBModule class.  Once you've gotten a DBAssociation, you should only send it querying messages; you never alter a DBAssociation directly.



Instance Variables

None declared in this class.



Method Types

Initializing initFetchGroup:expression:destination:
Querying the object destination
fetchGroup
expression
Manipulating the object contentsDidChange
setDestination:
currentRecordDidDelete
endEditing
selectedRowAfter:
selectionDidChange
validateEditing
getValue:
setValue:



Instance Methods

contentsDidChange
contentsDidChange

Notifies the DBAssociation that the destination's contents have changed.  You never invoke this method directly; it's invoked automatically by an internal mechanism.



currentRecordDidDelete
currentRecordDidDelete

Notifies the DBAssociation that the current record (in the associated DBRecordList) has been deleted.  You never invoke this method directly; it's invoked automatically by an internal mechanism.



destination
destination

Returns the user interface object that's associated with this DBAssociation.



endEditing
endEditing

Tells the DBAssociation to disallow further editing in the user interface object.  You never invoke this method directly; it's invoked automatically by an internal mechanism.



expression
expression

Returns the DBExpression that represents the property associated with this DBAssociation.



fetchGroup
fetchGroup

Returns the DBFetchGroup that owns this DBAssociation.



getValue:
getValue:value

Instructs the DBAssociation to copy the value from its destination into value.  You never invoke this method directly; it's invoked automatically by an internal mechanism.



initFetchGroup:expression:destination:
initFetchGroup:aFetchGroup expression:anExpr destination:aDest

Initializes an instance of DBAssociation such that anExpr, a DBExpression object that represents a property in a DBRecordList, is associated with the destination aDest.  The DBAssociation will be owned by aFetchGroup.  You never invoke this method directly; it's invoked automatically by the owning DBFetchGroup object.



setDestination:
setDestination:newDestination

Sets the DBAssociation's destination.  You should rarely need to invoke this method directly.  Returns self.



selectedRowAfter:
(unsigned int)selectedRowAfter:(unsigned int)previousRow

Returns the index of a row in the DBAssociation's destination to which this association is linked.  You never invoke this method directly; it's invoked automatically by an internal mechanism.



selectionDidChange
selectionDidChange

Notifies the DBAssociation that there has been some sort of change in the current row of the DBFetchGroup.  You never invoke this method directly; it's invoked automatically by an internal mechanism.



setValue:
setValue:value

Sets a value in the DBAssociation's DBRecordList.  You never invoke this method directly; it's invoked automatically by an internal mechanism.



validateEditing
validateEditing

Invokes validation for the DBAssociation's destination after editing.  You never invoke this method directly; it's invoked automatically by an internal mechanism.