|
|
Sample Programs from NeXSTEP 3.3
{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;\f1\fnil Times-Roman;\f2\fmodern Ohlfs;}
\paperw10800
\paperh10940
\margl2020
\margr100
{\colortbl;\red0\green0\blue0;}
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b\i0\ulnone\fs36\fc0\cf0 PubsDemo\
\b0\fs24 by Mai Nguyen, NeXT Developer Support Team\
\
\b\fs28 Overview
\b0\fs24 \
\
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
\b SybaseDemo.dbmodela
\b0 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
\b Select
\b0 ,
\b Insert
\b0 ,
\b Save
\b0 or
\b Delete
\b0 . Note that an
\b Insert
\b0 or
\b Delete
\b0 won't take effect in the database until a
\b Save
\b0 operation is performed. All operations such as
\b Save
\b0 ,
\b Delete
\b0 and
\b Select
\b0 are almost done without any coding. For simplicity's sake, there is no verification of the data entered via the FormCells for a
\b Save
\b0 or
\b Insert
\b0 operation.\
\
\b\fs28\fc1\cf1 Preferences Setting\
\b0\fs24 \
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.\
\
\b\fs28 Program Organization
\b0\fs24 \
\
\b Major Classes in the Application
\b0 \
\
\
\pard\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fi-1900\li1900\fc1\cf1 Controller A general manager object. A subclass of the Object class. Performs miscellaneous initialzations and operations such as inserting, selecting and sorting.\
\pard\tx560\tx1120\tx2060\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\fi-2060\li2060\fc1\cf1 \
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b\fc1\cf1 Other Peculiarities
\b0 \
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). \
\
\b\fs28 Topics Of Interest\
\b0\fs24 \
The purpose of this example is to show you some simple examples of the usage of the DBKit UI Objects:\
\pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\b\fc1\cf1 \
- How to extract the important DBKit elements from the UI Objects (DBDatabase, DBFetchGroup, etc.):
\b0 \
See the method
\b appDidInit:
\b0 in the file Controller.m.\
\f1\fs28 \
\f0\b\fs24 - How to change the sort order when retrieving records
\b0 \
See the method
\b changeRetrieveOrder:
\b0 and
\b setRetrieveOrder:
\b0 in the file Controller.m.\
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc1\cf1 \
-
\b How to qualify a select operation using DBQualifier\
\b0 See the method
\b buildSelectQualifier:
\b0 in the file Controller.m\
\
-
\b How to insert a new record to a database via the DBFetchGroup object
\b0 \
See the delegate method
\b fetchGroup:didInsertRecordAt:
\b0 in the file Controller.m\
\
\b\fs28 Change History\
\pard\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fs24\fi-1900\li1900\fc1\cf1 July 1993 Removed the
\b evaluateSQL:
\b0 method. To execute stored procedures, please refer to the Evaluator example.
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.