File:  [NeXTSTEP 3.3 examples] / Examples / DatabaseKit / AddressBook / README.rtf
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:49:00 2018 UTC (8 years, 1 month ago) by root
Branches: NeXT, MAIN
CVS tags: NeXTSTEP33, HEAD
Sample Programs from NeXSTEP 3.3

{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;\f1\fnil Times-Roman;\f2\fmodern Ohlfs;}
\paperw13680
\paperh11920
\margl120
\margr100
{\colortbl;\red0\green0\blue0;}
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b\i0\ulnone\fs36\fc1\cf1 AddressBook
\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. \
\
After you are properly connected to the Sybase server, you can perform operations such as Select, Insert, Update or Delete. Select is performed by clicking on a particular item in the scrollview, which will then display the person's record (last name, first name, social security,  phone, address, state of residence, zip code).  You have to fill in all these fields when adding a record. Text input is not validated since it is beyond the scope of this small example.\
 \
Note that this example only uses the DBKit Access Layer, which is useful to know if you need to create your own front-end to a database server. With the DBKit standard UI objects (TableView, DBModule), you could also create a similar example without much programming.\
 \

\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, adding and deleting records at a high level.\
\
 AddressView	A subclass of  the ScrollView class with a matrix of textfield cells. It handles lower level operations for adding, updating and deleting records. \

\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). \
In order to load an Adaptor dynamically, you need to add the
\b  OTHER_LDFLAGS
\b0  definition (see the 
\b Makefile.preamble
\b0 ). You also need to add the
\b  libdbkit_s.a
\b0  library into your
\b  PB.project
\b0  under 
\b libraries
\b0  in order to use the DBKit API. \
\

\b\fs28 Updating a Key Field\

\b0\fs24 \
Note that it is not possible to update a unique key field in the current DBKit version. In order to change your key field, you can first insert a new record with the modified key field, then delete the old record, then do an update.\

\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 Access Layer:\

\pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\b\fc1\cf1 \
- How to get connected to the SYBASE server via a default login string 
\b0 \
See the method 
\b appDidInit: 
\b0 in the file Controller.m.\

\f1\fs28 \

\f0\b\fs24 - How to fetch the data from a  database using a DBRecordList object
\b0 \
See the method 
\b loadCellsFrom:
\b0  in the file AddressView.m\

\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc1\cf1 \
- 
\b How to view all the values inside a record in a record list using the DBValue object\

\b0 See the method 
\b showInfo:
\b0  in the file AddressView.m\
\
- 
\b How to add a new record to a database via the DBRecordList object
\b0 \
See the method 
\b addRecordFrom:at: 
\b0  in the file AddressView.m\
\
- 
\b How to delete an existing record to a database via the DBRecordList object
\b0 \
See the method 
\b deleteSelectedRecord: 
\b0  in the file AddressView.m\
\
- 
\b How to update an existing record to a database via the DBRecordList object
\b0 \
See the method 
\b updateRecordFrom:at: 
\b0  in the file AddressView.m\
\
- 
\b How to  report the SQL queries generated by the Sybase adaptor via the database delegate method db:willEvaluateString:usingBinder:
\b0 \
See the file Controller.m\

\pard\tx2860\tx2860\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc1\cf1 \
 \

\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\b\fs28\fc1\cf1 Change History
\b0\fs24 \
May 1992		Upgraded for PR1\
August 1992	Upgraded to final 3.0 DBKIT API\
June 1993	Upgraded for 3.1
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.