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


4



Database Kit




The functionality of the Database Kit has been superceded by the Enterprise Object Framework. The Enterprise Object Framework product (available separately from NEXTSTEP) provides a way to develop object-oriented database applications. It provides tools for defining an object model and mapping it to a data model, which allows you to create objects that encapsulate both data and methods for operating on that data--and these objects can persist in a relational database accessible via the Framework's data services. You should use the Enterprise Objects Framework to develop database applications instead of the Database Kit.




Classes





DBAssociation


Inherits From: Object


Initializing

initFetchGroup:aFetchGroup Initializes; associates aFetchGroup with aDest
expression:anExpr
destination:aDest


Linking Expression and View

destination The association's user interface object
fetchGroup The DBFetchGroup that owns the association
expression The DBExpression that selects the properties displayed
setDestination:newDestination Sets the user association's user interface object


Methods to be Re-Defined in a Subclass of Association

contentsDidChange Notice to redisplay because the value changed
currentRecordDidDelete Notice to redisplay because a record was deleted
endEditing Notification that editing the destination must end
getValue:value Gets an object containing the association's data
(unsigned int)selectedRowAfter:(unsigned int)previousRow
The index of the next selected row
selectionDidChange Notice that the user has changed the selection
setValue:value Sets the association's data
validateEditing Notice to validate changes the user has made


Methods to be Defined in the Destination of a Custom Association

association:association Gets an object containing the association's data
getValue:(DBValue *)value
association:association Sets the association's data
setValue:(DBValue *)value
associationContentsDidChange:association Notice to redisplay because the value changed
associationCurrentRecordDidDelete:association
Notice to redisplay because a record was deleted
associationSelectionDidChange:association Notice that the user has changed the selection




DBBinder


Inherits From: Object
Conforms To: DBCursorPositioning


Initializing

init Initializes a new DBBinder instance
initForDatabase:aDBDatabase Initializes database, properties, qualifier; frees DBBinder
withProperties:(List *)propertyList
andQualifier:(DBQualifier *)aDBQualifier
free Frees the space allocated to a DBBinder


Connecting to a Database

(DBDatabase *)database The DBBimder's DBDatabase
setDatabase:(DBDatabase *)aDatabase Sets the DBBimder's DBDatabase


Managing Properties

(List *)getProperties:(List *)aList Gets and returns the DBBinder's properties
(List *)setProperties:(List *)aList Sets and returns the DBBinder's properties
addProperty:anObject Adds an object to the list of properties
removePropertyAt:(unsigned int)index Deletes one of the objects from the list of properties


Managing the Qualifier

(DBQualifier *)qualifier The DBBinder's qualifier
setQualifier:(DBQualifier *)aQualifier Sets the DBBinder's qualifier


Managing the Container

(id <DBContainers>)container The DBBinder's container
setContainer:(id <DBContainers>)anObject Sets the DBBinder's container
setFlushEnabled:(BOOL)flag Sets whether flushing the DBBinder is permitted
(BOOL)isFlushEnabled Reports whether flushing is enabled; default YES
setFreeObjectsOnFlush:(BOOL)flag Sets whether the DBBinder is freed when flushed
(BOOL)areObjectsFreedOnFlush YES if container objects freed when DBBinder is flushed


Managing the Record Prototype

+ setDynamicRecordClassName:(const char *)aName Assign a unique name to a class for unprototyped records

+ setDynamicRecordSuperclassName:(const char *)aName

Identify (existing) superclass for unprototyped records
setRecordPrototype:anObject Makes anObject the prototype for the DBBinder's records
createRecordPrototype Create default prototype object for the DBBinder's records
(BOOL)ownsRecordPrototype YES if createRecordPrototype will work (no prototype)
recordPrototype The DBBinder's record prototype
associateRecordIvar:(const char *)variableName Makes variableName report the value of aProperty
withProperty:(id <DBProperties>)aProperty
associateRecordSelectors:(SEL)set Sets the selectors for storing and retrieving aProperty
:(SEL)get
withProperty:(id <DBProperties>)aProperty
(DBValue *)valueForProperty:(id <DBProperties>)aProperty
The value of aProperty for the current record


Ordering and Ignoring Records

addRetrieveOrder:(DBRetrieveOrder)anOrder for:(id <DBProperties>)aProperty
Appends aProperty to the retrieve ordering criteria
removeRetrieveOrderFor:(id <DBProperties>)aProperty
Removes aProperty from the list of ordering criteria
(DBRetrieveOrder)retrieveOrderFor:(id <DBProperties>)aProperty
The direction in which aProperty is sorted on retrieve
(unsigned int)positionInOrderingsFor:(id <DBProperties>)aProperty
The rank order of aProperty in the list of order criteria
(BOOL)ignoresDuplicateResults YES if duplicate records are ignored during select
setIgnoresDuplicateResults:(BOOL)flag Sets whether duplicate records will be ignored in select


Accessing the Database

fetch Fetches record; puts in record objects (in the container)
select Selects records and fetches them
selectWithoutFetching Selects records in the database for fetching
insert Inserts the DBBinder's record objects into the database
update Updates the database for each record object
delete Deletes record object from the database
(BOOL)evaluateString:(const unsigned char *)aString
Tells the adaptor to evaluate aString (without qualifier)
(BOOL)adaptorWillEvaluateString:(const unsigned char *)aString
YES if delegate permits evaluation of aString; default YES


Fetching in a Thread

fetchInThread Starts an asynchronous fetch to the container
cancelFetch Aborts an asynchronous fetch
checkThreadedFetchCompletion:(double)timeout
Sends binderDidFetch: if an asynchronous fetch completes within timeout seconds


Limiting a Fetch

setMaximumRecordsPerFetch:(unsigned int)limit
Sets maximum records per synchronous fetch
(unsigned int)maximumRecordsPerFetch Returns maximum records per fetch; default unlimited
(BOOL)recordLimitReached YES if the previous fetch stopped for the record limit


Using the Shared Cursors for Several Binders

setSharesContext:(BOOL)flag Set whether this binder uses the shared cursor
(BOOL)sharesContext YES if this binder uses the shared cursor


Managing General Resources

reset Cancels any fetch, then flushes and frees objects
(BOOL)flush If enabled, empties the container
(NXZone *)scratchZone The zone the DBBinder is now using for allocations


Appointing a Delegate

delegate The object that receives notification messages
setDelegate:anObject Sets the object to receive notification messages


Archiving

read:(NXTypedStream *)stream Creates an instance by reading from a typed stream
write:(NXTypedStream *)stream Archives an instance by writing to a typed stream


Methods Implemented by the Delegate

binder:aBinder didEvaluateString:(const unsigned char *)aString
Notification that aString was evaluated by the adaptor
(BOOL)binder:aBinder willEvaluateString:(const unsigned char *)aString
Notification that aString will be sent the adaptor; YES lets evaluation proceed
binderDidDelete:aBinder Notification that records were deleted from the database
binderDidFetch:aBinder Notification that records were fetched from the database
binderDidInsert:aBinder Notification that records were inserted in the database
binderDidSelect:aBinder Notification that records were selected (but not fetched)
binderDidUpdate:aBinder Notification that database records were updated
(BOOL)binderWillDelete:aBinder YES permits deleting binder's records from the database
(BOOL)binderWillFetch:aBinder YES permits records to be fetched from the database
(BOOL)binderWillInsert:aBinder YES permits records to be in sorted in the database
(BOOL)binderWillSelect:aBinder YES permits records to be selected in the database
(BOOL)binderWillUpdate:aBinder YES permits records to update the database




DBDatabase


Inherits From: Object


Initializing the Class

+ initialize Sent automatically; prepares class to respond to inquiries


Reporting What's Available

+ (const char **)adaptorNames List of the names of available adaptors
+ (const char **)databaseNamesForAdaptor:(const char *)anAdaptorName
List of database available through anAdaptorName


Initializing an Instance

initFromFile:(const char *)aPath Initializes and loads information from a model file


Describing the Model Source

(const char *)directory The directory from which the model was loaded
(const char *)name The model's name in the class's name table
(BOOL)setName:(const char *)aString Sets the model's name in the class's name table
(const char *)currentAdaptorName The name of the current database adaptor
(const char *)defaultAdaptorName The name of the model's default adaptor
(const unsigned char *)defaultLoginString The model's default login string
(const unsigned char *)currentLoginString The current login string
(const unsigned char *)loginStringForUser:(const char *)aUser
The the model's login string for user aUser


Describing the Database Model

(id <DBEntities>)entityNamed:(const char *)aName
Returns an object embodying entity aName
(List *)getEntities:(List *)aList Returns a list of the names of the model's entities


Revising the Data Dictionary

emptyDataDictionary Frees the current data dictionary
loadDefaultDataDictionary Replaces the data dictionary by querying the database


Connecting to the Database

+ findDatabaseNamed:(const char *)aName Returns a DBDatabase instance, after loading model
connect:(BOOL)flag aName and (and, if flag is YES, connecting to it)
(BOOL)connect Opens a connection to database using the default login
(BOOL)connectUsingString:(const unsigned char *)aString
Opens database connection to database by sending aString
(BOOL)connectUsingAdaptor:(const char *)aClassname
andString:(const unsigned char *)aString Opens database connection via anAdaptor and aString
(BOOL)disconnect Disconnects from the database
(BOOL)disconnectUsingString:(const unsigned char *)aString
Disconnects from the database by sending it aString
(BOOL)isConnected YES if there is a valid connection to the database
(const unsigned char *)connectionName The name assigned to the current connection


Managing Transactions

(BOOL)beginTransaction YES if a new transaction is successfully started
(BOOL)rollbackTransaction YES if a the current transaction is successfully rolled back
(BOOL)commitTransaction YES if a the current transaction is successfully committed
(BOOL)isTransactionInProgress YES is a transaction is in progress
(BOOL)areTransactionsEnabled YES if transactions are enabled
(BOOL)enableTransactions:(BOOL)flag Enable/disable transaction; returns YES if successful


Using a Delegate

delegate The object that receives notification messages
setDelegate:anObject Sets the object that receives notification messages


Evaluating an Arbitrary String

(BOOL)evaluateString:aString Returns YES if the adaptor evaluates the string


Controlling the User Interface

(BOOL)arePanelsEnabled YES if UI panels can respond to problems
setPanelsEnabled:(BOOL)flag Enable/disable response by UI panels


Archiving

read:(NXTypedStream *)stream Creates an instance by reading from a typed stream
write:(NXTypedStream *)stream Archives an instance by writing to a typed stream


Methods Implemented in the Delegate

db:aDatabase Notification of log message sent by aDatabase
log:(const char*) fmt, ...
(BOOL)db:aDatabase Notification of a message received from aDatabase;
notificationFrom:anObject Returns YES when the user acknowledges the notifiation.
message:(const unsigned char*)msg
code:(int)n
(BOOL)db:aDatabase Notice that aString will be evaluated; YES lets it proceed
willEvaluateString:(const char *)aString
usingBinder:(const char *)aBinder
dbDidRollbackTransaction:sender Notification that database rolled back a transaction
dbDidCommitTransaction:sender Notification that database committed a transaction
dbWillCommitTransaction:sender Notification that database will commit a transaction
dbWillRollbackTransaction:sender Notification that database will roll back a transaction




DBEditableFormatter


Inherits From: DBFormatter : Object


Initializing

init Initializes a new instance
free Frees the space an instance formerly used


Manipulating Font

font Returns the font used in the editable display
setFont:aFont Sets the font used in the editable display


Displaying and Editing

drawFieldAt:(unsigned int) row Displays one field of the data source's current record
:column taken from position row or column of the dynamic axis,
inside:(NXRect *)frame using rowAttrs or colAttrs to identify static attributes,
inView:aView and flags useRowPos and useColumnPos to select which
withAttributes:(id <DBTableVectors>) rowAttrs
:(id <DBTableVectors>)columnAttrs
usePositions:(BOOL)useRowPos
:(BOOL)useColumnPos
(BOOL)editFieldAt:(unsigned int)row Displays and prepares to edit one field of the data source's
:(unsigned int)column current record, taken from row or column of dynamic axis,
inside:(NXRect *)frame using rowAttrs or colAttrs to identify static attributes,
inView:aView and flags useRowPos and useColumnPos to select which;
withAttributes:(id <DBTableVectors>) rowAttrs
:(id <DBTableVectors>) columnAttrs returns YES if editing was permitted
usePositions:(BOOL)useRowPos
:(BOOL)useColumnPos
onEvent:theEvent


Controlling Editing

abortEditing Forces an end to editing and discards changes; returns self
(BOOL)endEditing Ends editing when user clicks elsewhere Returns YES if that becomes first responder


Archiving

read:(NXTypedStream *)stream Creates an instance by reading from a typed stream
write:(NXTypedStream *)stream Archives an instance by writing to a typed stream
finishUnarchiving Automatically invoked final step in unarchiving


Methods Implemented by the Delegate

See DBFormatterValidation protocol.




DBExpression


Inherits From: Object
Conforms To: DBExpressionValues
DBProperties


Creating and Freeing a DBExpression

initForEntity:(id <DBEntities>)anEntity Initializes for anEntity, with description string shown
fromDescription:(const unsigned char *)descriptionFormat, ...
initForEntity:(id <DBEntities>)anEntity Initializes anEntity, from property aName,
fromName:(const char *)aName to have data type aType
usingType:(const char *)aType
copyFromZone:(NXZone *)zone Returns new copy of receiver, allocated from zone
free Frees the space that an instance formerly used


Setting the Entity and Description

setEntity:(id <DBEntities>)anEntity Sets anEntity, with the description string shown
andDescription:(const unsigned char *)descriptionFormat, ...


Archiving

read:(NXTypedStream *)stream Creates an instance by reading from a typed stream
write:(NXTypedStream *)stream Archives an instance by writing to a typed stream




DBFetchGroup


Inherits From: Object


Initializing

initEntity:anEntity Initialize a new instance for links to anEntity
setName:(const char *)aName Invoked automatically; matches the name to the attribute it fetches


Reporting Current Context

(const char *)name Returns the name (set to match the attribute it fetches)
module The DBModule that owns the fetch group
entity The DBEntity for which the fetch group fetches
recordList The DBRecordList in which fetched records are stored
(unsigned int)currentRecord The index within the DBRecordList of the current record
(unsigned int)recordCount The number of records in the DBRecordList


Controlling Current Selection

setAutoselect:(BOOL)flag If YES, fetch selects first row, delete selects next rowf
(BOOL)doesAutoSelect Returns flag set by setAutoselect:; default YES
setCurrentRecord:(unsigned int)newIndex Sets a position within the DBRecordList
clearCurrentRecord Deselects current record
(unsigned int)selectedRowAfter:(unsigned int)previousRow
Index of first selected row after previousRow
redisplayEverything Displays all of DBFetchGroup's DBAssociations


Manipulating Contents

deleteCurrentSelection Deletes the selected records from the DBRecordList
(BOOL)insertNewRecordAt:(unsigned int)index Inserts a (default) record in the DBRecordList at index
fetchContentsOf:aSource usingQualifier:aQualifier
Replaces all records by reading aSource using aQualifier


Dealing with Changes

(BOOL)hasUnsavedChanges YES if the DBRecordList has been changed but not saved
(BOOL)validateCurrentRecord YES unless delegates for editor or DDModule object
saveChanges Saves changes in this or subordinate fetch groups
discardChanges Discards changes in this and subordinate fetch groups


Using Associations

addExpression:newExpression Adds newExpression to the list of expressions to fetch
takeValueFromAssociation:anAssociation Puts the displayed value into the DBRecordList
addAssociation:newAssociation Adds newAssociation to the list of associations
removeAssociation:anAssociation Removes anAssociation from the list of associations


Using a Delegate

delegate The object that receives notification messages
setDelegate:anObject Sets the object to receive notification messages


Methods Implemented by the Delegate

fetchGroup:fetchGroup
didInsertRecordAt:(int)index Notification of a new record in the DBRecordList
(BOOL)fetchGroup:fetchGroup Notification of pending validation; YES lets it proceed
willValidateRecordAt:(int)index
fetchGroup:fetchGroup Notification of pending deletion; YES lets it proceed
willDeleteRecordAt:(int)index
(DBFailureResponse)fetchGroup:fetchGroup Returns constant to indicate response to failure notice
willFailForReason:(DBFailureCode)code
fetchGroupDidFetch:fetchGroup Notification of new contents in DBRecordList
fetchGroupDidSave:fetchGroup Notification that DBRecordList has been saved
fetchGroupWillChange:fetchGroup Notification that user made changes in the DBRecordList
fetchGroupWillFetch:fetchGroup Notification that fetch will change the DBRecordList
(BOOL)fetchGroupWillSave:fetchGroup Notification of pending save; YES lets it proceed




DBFormatter
(abstract superclass)


Inherits From: Object


Controlling the Data Source

dataSource Returns the DBRecordList (or other source)
setDataSource:newDataSource Makes newDataSource the place to get values for display


Getting the Value to be Formatted

getValueAt:(unsigned int) row Returns a DBValue from the DBRecordList,
:column taking it from position row or column of the dynamic axis,
inside:(NXRect *)frame using rowAttrs or colAttrs to identify static attributes,
inView:aView and flags useRowPos and useColumnPos to select which
withAttributes:(id <DBTableVectors>) rowAttrs
:(id <DBTableVectors>)columnAttrs
usePositions:(BOOL)useRowPos
:(BOOL)useColumnPos


Formatting a Field

drawFieldAt:(unsigned int) row Displays one field of the data source's current record
:column taken from position row or column of the dynamic axis,
inside:(NXRect *)frame using rowAttrs or colAttrs to identify static attributes,
inView:aView and flags useRowPos and useColumnPos to select which
withAttributes:(id <DBTableVectors>) rowAttrs
:(id <DBTableVectors>)columnAttrs
usePositions:(BOOL)useRowPos
:(BOOL)useColumnPos


Batching Format Requests

beginBatching:(id <DBTableVectors>) attrs Notification that format attrs apply to all following items
endBatching Marks the end of a block of  items formatted the same way
resetBatching:(id <DBTableVectors>)attrs Begin batching if not already started


Appointing a Delegate

delegate The object that receives notification messages
setDelegate:anObject Sets the object to receive notification messages




DBImageFormatter


Inherits From: DBFormatter : Object


Initializing

init Initializes a new instance
free Frees the space an instance formerly used


Default

setDefaultImage:anImage Set image to be shown when the data has none
defaultImage The image displayed when the data has none


Display

drawFieldAt:(unsigned int) row Displays one image from the data source's current record
:column taken from position row or column of the dynamic axis,
inside:(NXRect *)frame using rowAttrs or colAttrs to identify static attributes,
inView:aView and flags useRowPos and useColumnPos to select which
withAttributes:(id <DBTableVectors>) rowAttrs
:(id <DBTableVectors>)columnAttrs
usePositions:(BOOL)useRowPos
:(BOOL)useColumnPos


Archiving

read:(NXTypedStream *)stream Creates an instance by reading from a typed stream
write:(NXTypedStream *)stream Archives an instance by writing to a typed stream




DBImageView


Inherits From: Control : View : Responder : Object


Internals

initFrame:(const NXRect *)frameRect Initializes the view in the frame coordinates
drawSelf:(const NXRect *)rects Called by display to draw the image
:(int)rectCount


Getting/Setting the Image

image Returns the image being displayed
setImage:newImage Makes newImage the image to display


Getting/Setting the Border

setStyle:(int)newStyle Sets the style of border for the image
(int)style Returns a constant indicating the border style


Editing

(BOOL)isEditable YES if the image can be deleted or replaced
setEditable:(BOOL)flag Allow/prohibit deleting or replacing the image




DBModule


Inherits From: Object


Reporting the Context

database The DBModule's DBDatabase
entity The DBModule's DBEntity
rootFetchGroup The DBModule's root DBFetchGroup
associationForObject:anObject The DBAssociation that handles UI object anObject
editingAssociation The DBAssociation currently involved in editing
getFetchGroups:(List *)aList Returns a list of all the DBModule's DBFetchGroups
fetchGroupNamed:(const char *)aName Returns the DBFetchGroup for the property named aName


Initializing and Configuring

initDatabase:aDatabase
entity:anEntity Initializes a new DBModule with the given DBDatabase and DBEntity,
fetchContentsOf:aSource Fetches records for the DBEntity or DBValue aSource,
usingQualifier:aQualifier using aQualifier to select records
addFetchGroup:aFetchGroup Invoked to add aFetchGroup to the list of fetch groups


Responding to User Actions

fetchAllRecords:sender Fetches all records for the DBModule's root fetch group
saveChanges:sender Saves in the database changes made to the fetched records
discardChanges:sender Discard changes proposed for the fetched records
deleteRecord:sender Delete one of the fetched records
appendNewRecord:sender Append a new (default) record to those fetched
insertNewRecord:sender Insert a new (default) record at the current position
nextRecord:sender Select the next of the fetched records
previousRecord:sender Select the preceding of the fetched records
takeValueFrom:sender UI object has a new value, so fetched record is revised
textDidEnd:textObject User has finished editing a text field
endChar:(unsigned short)whyEnd
(BOOL)textWillChange:textObject User has entered an editable field; YES lets editing proceed
(BOOL)textWillEnd:textObject Notification that an editable field will relinquish first responder; YES lets the change proceed


Using a Delegate

delegate The object that receives notification messages
setDelegate:anObject Sets the object to receive notification messages


Methods Implemented by the Delegate

moduleDidSave:module Called when module has completed a save to the database
(BOOL)moduleWillLoseChanges:module Called when module is about to discard user's changes
(BOOL)moduleWillSave:module Called when module is about to save to the database




DBQualifier


Inherits From: Object
Conforms To: DBExpressionValues


Initializing and Freeing

+ initialize Automatically invoked to initialize the class
initForEntity:(id <DBEntities>)anEntity Initializes a new instance to select from anEntity
initForEntity:(id <DBEntities>)anEntity Initializes to select from anEntity by descriptionFormat
fromDescription:(const unsigned char *)descriptionFormat, ...
copyFromZone:(NXZone*)z Returns a copy of the DBQualifier, allocating from z
free Frees space that a DBQualifier formerly used


Modifying

addDescription:(const unsigned char *)descriptionFormat, ...
Appends descriptionFormat to the qualifier descriptions
setEntity:(id <DBEntities>)anEntity Sets both anEntity and qualifying descriptionFormat
andDescription:(const unsigned char *)descriptionFormat, ...
(BOOL)setName:(const char *)aName Assigns the DBQualifier aName and returns YES
(BOOL)empty Deletes the qualifying descriptions and returns YES


Querying

(const char *)name Returns the name assigned to the DBQualifier
(id <DBEntities>)entity Returns the DBQualifier's entity
(BOOL)isEmpty Returns YES if the qualifying descriptions are empty


Archiving

read:(NXTypedStream *)stream Creates an instance by reading from a typed stream
write:(NXTypedStream *)stream Archives an instance by writing to a typed stream




DBRecordList


Inherits From: DBRecordStream
Conforms To: DBContainers
DBCursorPositioning


Initializing and Freeing

init Initializes a new instance of DBRecordList
free Frees the space a DBRecordList formerly used
clear Empties the record list and lists of properties


Setting the Retrieval Mode

setRetrieveMode:(DBRecordListRetrieveMode)aMode
Sets the DBRecordList's retrieval strategy
(DBRecordListRetrieveMode)currentRetrieveMode
Returns a constant identifying the retrieval strategy


Fetching Data from the Database

fetchRecordForRecordKey:(DBValue *)aValue Fetches records qualified by matching aValue
fetchUsingQualifier:(DBQualifier *)aQualifier Empties, then fetches records selected by aQualifier
fetchUsingQualifier:(DBQualifier *)aQualifier Fetches records selected by aQualifier;
empty:emptyFirst if emptyFirst is YES, first empties the record list
(unsigned int)recordLimit Returns the maximum number of records to fetch
setRecordLimit:(unsigned int)count Sets the maximum number of records to fetch


Accessing Data in the DBRecordList

getValue:(DBValue *)aValue Puts the current record's value for aProperty into aValue
forProperty:aProperty
getValue:(DBValue *)aValue Puts value of aProperty for the record at index into aValue
forProperty:aProperty
at:(unsigned int)index
getRecordKeyValue:(DBValue *)aValue Puts the key value for the current record into aValue
getRecordKeyValue:(DBValue *)aValue Puts the key value for the record at index into aValue
at:(unsigned int)index


Modifying Data in the DBRecordList

setValue:(DBValue *)aValue Sets the current record's value of aProperty to aValue
forProperty:aProperty
setValue:(DBValue *)aValue Sets value of aProperty for record at index to aValue
forProperty:aProperty
at:(unsigned int)index
insertRecordAt:(unsigned int)index Inserts a (default) record ahead of the record at index
appendRecord Inserts a (default) record after the last one
newRecord Inserts a (default) record to precede the current record
(BOOL)isNewRecord YES if the current record is one that has been inserted
(BOOL)isNewRecordAt:(unsigned int)index YES if the record at index had been inserted
deleteRecord Deletes the current record
deleteRecordAt:(unsigned int)index Deletes the record at index
(BOOL)isModified YES if the current record has been changed or inserted
(BOOL)isModifiedAt:(unsigned int)index YES if the record at index has been changed or inserted
(BOOL)isModifiedForProperty:aProperty YES if aProperty of the record at index has been changed
at:(unsigned int)index


Using Record Indexes

(unsigned int)positionForRecordKey:(DBValue *)aValue
Returns the index of the record whose key is aValue
moveRecordAt:(unsigned int)sourceIndex Moves record at sourceIndex to precede the record now
to:(unsigned int)destinationIndex at destinationIndex
swapRecordAt:(unsigned int)anIndex Transposes the positions of the two records
withRecordAt:(unsigned int)anotherIndex


Saving Data

(unsigned int)saveModifications Saves to the database any changes since the fetch; returns code for success, partial success, or failure




DBRecordStream


Inherits From: Object


Initializing and Freeing

init Initializes a new instance
free Frees space formerly used by a DBRecordStream


Setting up a DBRecordStream

addRetrieveOrder:(DBRetrieveOrder)anOrder Appends anOrder (up/down) to sort criteria for aProperty
for:(id <DBProperties>)aProperty
(List *)setProperties:(List *)propertyList Sets/returns list of properties wanted from entity aSource
ofSource:aSource
(List *)getProperties:(List *)propertyList Returns and puts into propertyList the stream's properties
(List *)setKeyProperties:(List *)propertyList Sets and returns propertyList as the stream's key properties
(List *)getKeyProperties:(List *)keyList Returns/ puts into propertyList the stream's key properties


Fetching Data

fetchUsingQualifier:(DBQualifier *)aQualifier Starts fetching records that pass aQualifier
cancelFetch Stops fetching and sends fetchDone to DBDatabase
(DBRecordRetrieveStatus)currentRetrieveStatus DB_Ready/NotReady, DB_FetchInProgress/Completed


Accessing Data

getValue:(DBValue *)aValue forProperty:aProperty
Puts current record's aProperty's value into aValue
getRecordKeyValue:(DBValue *)aValue Puts current record's key value into aValue
setNext Makes next record available; nil if none left


Modifying Data

setValue:(DBValue *)aValue forProperty:aPropert
Sets the current record's aProperty to aValue
newRecord Inserts new, empty record at the current record
deleteRecord Deletes the current record
(BOOL)isNewRecord YES if the current record is a new one
(BOOL)isModified YES if the current record is new or has been modified
(BOOL)isReadOnly YES if the record stream cannot be modified


Saving Modifications

(unsigned int)saveModifications Writes current record's modifications to the database


Resetting a DBRecordStream

clear Resets everything except the delegate


Assigning Delegates

delegate The object that receives notification messages
setDelegate:anObject Sets the object that will receive notification messages
binderDelegate The object that receives notification messages for binders
setBinderDelegate:anObject Sets the object to receive notification messages for binders


Method Implemented by the Delegate

(BOOL)recordStream:sender Invoked when changes can't be saved; aCode tells why;
willFailForReason:(DBFailureCode) aCode YES acknowledges failure; NO tries to proceed with those records that are not affected
(BOOL)recordStreamPrepareCurrentRecordForModification:aRecordStream
Invoked when a record will be modififed or deleted; YES permits modification to proceed




DBTableVector


Inherits From: Object
Conforms To: DBTableVectors


Creating the Object

initIdentifier:anIdentifer Initialize a DBTableVector for property anIdentifier
free Free the space formerly allocated to a DBTableVector




DBTableView


Inherits From: ScrollView : View : Responder : Object


Initializing and Freeing

initFrame:(const NXRect *)newFrame Initializes an instance located within newFrame
free Frees space formerly used by a DBTableView


Setting up the DBTableView

setDataSource:aSource Sets the object that will provide data for the display
dataSource The object that provides data for the display
setDelegate:delegate Sets the object that will receive notification messages
delegate The object that receives notification messages


Displaying

  drawSelf:(const NXRect *) rects :(int) count


Setting and Reporting Formatting

formatterAt:(unsigned int)row :(unsigned int)column
Returns the DBFormatter for the field at row and column
(BOOL)dynamicRows YES if rows are dynamic
(BOOL)dynamicColumns YES if columns are dynamic
(BOOL)isRowHeadingVisible YES if row heading view is visible
(BOOL)isColumnHeadingVisible YES if column heading view is visible
setIntercell:(const NXSize *)aSize Sets space between neighboring rows and columns
getIntercell:(NXSize *)theSize Puts space between rows and columns into theSize
setGridVisible:(BOOL)flag Makes grid lines between rows and columns visible or not
(BOOL)isGridVisible YES if grid lines are visible
acceptArrowKeys:(BOOL)flag Makes arrow keys acceptable for navigation
(BOOL)doesAcceptArrowKeys YES if arrow keys are accepted for navigation
allowVectorReordering:(BOOL)flag Lets/prevents user drag static row/column to new position
(BOOL)doesAllowVectorReordering YES if user is permitted to reorder static row or column
allowVectorResizing:(BOOL)flag Lets/prevents user drag the width of static row or column
(BOOL)doesAllowVectorResizing YES if user can drag row or column to change width


Notifying the DBTableView of Change

reloadData:sender Redraw because data may have changed
layoutChanged:sender Redraw because row or column spacing changed
rowsChangedFrom:(unsigned int)startRow Redraw because data changed in a block of rows
to:(unsigned int)endRow
columnsChangedFrom:(unsigned int)startColumn Redraw because data changed in a block of columns
to:(unsigned int)endColumn


Handling Rows and Columns

(unsigned int)columnCount Total number of columns
(unsigned int)rowCount Total number of rows
(id <DBTableVectors>)rowAt:(unsigned int)aPosition
Object specifying format of the static row at aPosition
(id <DBTableVectors>)columnAt:(unsigned int)aPosition
Object specifying format of the static column at aPosition
addColumn:identifier Adds an static column at aPosition
at:(unsigned int)aPosition
addColumn:identifier Adds a static column with title at aPosition
withTitle:(const char *)title
addColumn:identifier Adds a static column with title and formatter at aPosition
withFormatter:formatter
andTitle:(const char *)title
at:(unsigned int)aPosition
removeColumnAt:(unsigned int)columnPosition Deletes a static column
(BOOL)moveColumnFrom:(unsigned int)oldPos Changes a static column's position
to:(unsigned int)newPos
addRow:identifier Adds an static row at aPosition
at:(unsigned int)aPosition
addRow:identifier Adds a static row with title at aPosition
withTitle:(const char *)title
addRow:identifier Adds a static row with title and formatter at aPosition
withFormatter:formatter
andTitle:(const char *)title
at:(unsigned int)aPosition
removeRowAt:(unsigned int)rowPosition Deletes a static row
(BOOL)moveRowFrom:(unsigned int)oldPos Changes a static row's position
to:(unsigned int)newPos
(unsigned int)indedOfColumnWithIdentifier:anIdentifier
Position in sequence of static column anIdentifier
(unsigned int)indexOfRowWithIdentifier:anIdentifier
Position in sequence of static row anIdentifier


Editing Support

editFieldAt:(unsigned int)row Selects an item and invokes editor
:(unsigned int)column
setEditable:(BOOL)flag Enables/disables editing.
(BOOL)isEditable YES of the DBTableView is editable.


Handling the Selection

setMode:(int)newMode Make selection list mode, radio mode, or none.
(int)mode Returns DB_NOSELECT/RADIOMODE/LISTMODE
allowEmptySel:(BOOL)flag Allow/prohibit user to leave nothing selected
(BOOL)doesAllowEmptySel YES if user may leave nothing selected
(unsigned int)selectedRowCount Number of rows currently selected
(unsigned int)selectedColumnCount Number of columns currently selected
(int)selectedRow The row number of the selected row
(int)selectedColumn The column number of the selected column
(BOOL)isRowSelected:(unsigned int)row YES if row is selected
(BOOL)isColumnSelected:(unsigned int)column YES if column is selected
deselectAll:sender Makes nothing selected.
selectAll:sender Makes all rows and columns selected.
setRowSelectionOn:(unsigned int)start Sets block of rows to selected (YES) or deselected (NO)
:(unsigned int)end
to:(BOOL)flag
setColumnSelectionOn:(unsigned int)start Sets block of columns to selected (YES) or deselected
:(unsigned int)end
to:(BOOL)flag
selectRow:(unsigned int)row Selects row, or extends selection if flag is YES
byExtension:(BOOL)flag
selectColumn:(unsigned int)column Selects row, or extends selection if flag is YES
byExtension:(BOOL)flag
deselectRow:(unsigned int)row Deselects the indicated row
deselectColumn:(unsigned int)column Deselects the indicated column
(unsigned int)selectedRowAfter:(unsigned int)aRow
Index of the first selected row after aRow
(unsigned int)selectedColumnAfter:(unsigned int)aColumn
Index of the first selected column after aColumn
sendAction:(SEL)anAction Sends anAction to anObject for each selected row;
to:anObject if YES, does it for each selected row
forSelectedRows:(BOOL)flag
sendAction:(SEL)anAction Sends anAction to anObject for each selected column;
to:anObject if YES, does it for each selected column
forSelectedColumns:(BOOL)flag


Setting DBTableView Components

rowHeading Returns the row heading view
setRowHeading:newRowHeading Makes newRowHeading the row heading view
setRowHeadingVisible:(BOOL)flag Makes the row heading visible or not
columnHeading Returns the column heading view
setColumnHeading:newColumnHeading Makes newColumnHeading the column heading view
setColumnHeadingVisible:(BOOL)flag Makes the column heading visible or not


Adjusting the View

display Displays the DBTableView
scrollClip:aClip Sets aClip's origin to be newOrigin in the content view
to:(const NXPoint *)newOrigin
(BOOL)isHorizScrollerVisible YES if the content view's horizontal scroller is enabled
setHorizScrollerVisible:(BOOL)flag Makes the content view's horizontal scroller visible or not
(BOOL)isVertScrollerVisible YES if the content view's vertical scroller is visible
setVertScrollerVisible:(BOOL)flag Makes the content view's vertical scroller visible
tile Recalculate positions of the component views and redraw
sizeTo:(NXCoord)width Adjust the overall size to width and height, and redraw
:(NXCoord)height
scrollRowToVisible:(unsigned int)row Scroll the content so that row is visible in the scroll clip
scrollColumnToVisible:(unsigned int)column Scroll the content so that column is visible in the scroll clip
(BOOL)acceptsFirstResponder YES if the DBTableView will handle keyboard events


Transmitting Action

setAction:(SEL)aSelector Makes aSelector the action in response to a click
(SEL)action The action to be sent on a click
setDoubleAction:(SEL)aSelector Makes aSelector the action in response to a double click
(SEL)doubleAction The action in response to a double click
setTarget:anObject Makes anObject the target for an action message
target The target for an action message


Archiving

read:(NXTypedStream *)stream Creates an instance by reading from a typed stream
write:(NXTypedStream *)stream Archives an instance by writing to a typed stream
finishUnarchiving Automatically invoked final step in unarchiving




DBTextFormatter


Inherits From: DBFormatter : Object


Initializing

init Initializes a new DBTextFormatter instance
free Frees the space allocated to a DBTextFormatter.


Manipulating Font

font Returns the formatter's font
setFont:aFont Makes aFont the formatter's font


Batching Format Requests

beginBatching:(id <DBTableVectors>) attrs The format attrs applies to all following records
resetBatching:(id <DBTableVectors>) attrs Begins batching if not already in effect
endBatching Completes sequence of records in same format


Archiving

read:(NXTypedStream *)stream Creates an instance by reading from a typed stream
write:(NXTypedStream *)stream Archives an instance by writing to a typed stream




DBValue


Inherits From: Object
Conforms To: DBExpressionValues


Creating and Freeing

+ initialize Initialize the class (sent by a subclass)
init Initialize a DBValue instance
free Free space formerly used by a DBValue instance


Setting Values

setDoubleValue:(double)aDouble Sets the object's value to aDouble
setFloatValue:(float)aFloat Sets the object's value to aFloat
setIntValue:(int)anInt Sets the object's value to anInt
setObjectValue:(id)anObject Sets the object's value to anObject
setObjectValueNoCopy:(id)anObject Sets the object's value so that it points to anObject
setStringValue:(const char *)aString Sets the object's value to aString
setStringValueNoCopy:(const char *)aString Sets the object's value so that it points to aString
setValueFrom:(DBValue *)aValue Sets the object's to have the same value as aValue
setNull Sets the object's value to NULL


Reporting Values

(id <DBTypes>)valueType Returns the type of value the object contains
(BOOL)isEqual:(DBValue *)anotherValue YEs if this object has same type and value as anotherValue
(double)doubleValue Returns the object's value as a double
(float)floatValue Returns the object's value as a float
(int)intValue Returns the object's value as an int
objectValue Returns the object's value as an object
(const char *)stringValue Returns the object's value as a string
(BOOL)isNull YES if the object's value is NULL


Archivingt

read:(NXTypedStream *)stream Creates an instance by reading from a typed stream
write:(NXTypedStream *)stream Archives an instance by writing to a typed stream