PubsDemo
by Mai Nguyen, NeXT Developer Support Team

Overview

In order to run this example, you need to have a SYBASE server with a pubs database installed.  The pubs database is a sample database provided with the SYBASE limited server package.  The  SybaseDemo.dbmodela from /NextDeveloper/Examples/DatabaseKit/models  is used to establish the proper connections between the database model and the Database Kit UI Objects.

The purpose of this example is to show you how to quickly put together a simple database application without much programming by taking advantage of the Database Kit UI Objects such as DBTableView and DBModule.

After you are properly connected to the Sybase server, you can perform operations such as Select, Insert, Save or Delete.  Note that an Insert or Delete won't take effect in the database until a Save operation is performed.  All operations such as Save, Delete and Select are almost done without any coding. For simplicity's sake, there is no verification of the data entered via the FormCells for a Save or Insert operation.

Preferences Setting

You can retrieve the data in ascending or descending order by selecting the Sort Order with the Radio buttons. Note that the tag values of these Radio Buttons correspond to the actual constants defined in dbkit/enums.h.
You can either select all records by default, or qualify them by state of residence by entering the proper state into the textfield.

Program Organization

Major Classes in the Application

Controller	A general manager object.  A subclass of the Object class.  Performs miscellaneous initialzations and operations such as  inserting, selecting and sorting.
 
Other Peculiarities
The primary key for inserting a new record is the social security number. It is not possible to insert a new record with a duplicate id (or social security number). 

Topics Of Interest

The purpose of this example is to show you some simple examples of the usage of the DBKit UI Objects:

- How to extract the important DBKit elements from the UI Objects (DBDatabase, DBFetchGroup, etc.): 
See the method appDidInit: in the file Controller.m.

- How to change the sort order when retrieving records
See the method changeRetrieveOrder: and setRetrieveOrder: in the file Controller.m.

- How to qualify a select operation using DBQualifier
See the method buildSelectQualifier: in the file Controller.m

- How to insert a new record to a database via the DBFetchGroup object
See the delegate method fetchGroup:didInsertRecordAt:  in the file Controller.m

Change History
July 1993	Removed the evaluateSQL: method. To execute stored procedures, please refer to the MultiBinder example.