|
|
1.1 root 1: {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;\f1\fnil Times-Roman;\f2\fmodern Ohlfs;}
2: \paperw13680
3: \paperh11920
4: \margl120
5: \margr100
6: {\colortbl;\red0\green0\blue0;}
7: \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b\i0\ulnone\fs36\fc1\cf1 AddressBook
8: \b0\fs24 \
9: by Mai Nguyen, NeXT Developer Support Team\
10: \
11:
12: \b\fs28 Overview
13: \b0\fs24 \
14: \
15: 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. \
16: \
17: 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.\
18: \
19: 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.\
20: \
21:
22: \b\fs28 Program Organization
23: \b0\fs24 \
24: \
25:
26: \b Major Classes in the Application
27: \b0 \
28: \
29: \
30:
31: \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.\
32: \
33: AddressView A subclass of the ScrollView class with a matrix of textfield cells. It handles lower level operations for adding, updating and deleting records. \
34:
35: \pard\tx560\tx1120\tx2060\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\fi-2060\li2060\fc1\cf1 \
36: \
37:
38: \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b\fc1\cf1 Other Peculiarities
39: \b0 \
40: 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). \
41: In order to load an Adaptor dynamically, you need to add the
42: \b OTHER_LDFLAGS
43: \b0 definition (see the
44: \b Makefile.preamble
45: \b0 ). You also need to add the
46: \b libdbkit_s.a
47: \b0 library into your
48: \b PB.project
49: \b0 under
50: \b libraries
51: \b0 in order to use the DBKit API. \
52: \
53:
54: \b\fs28 Updating a Key Field\
55:
56: \b0\fs24 \
57: 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.\
58:
59: \b\fs28 \
60: Topics Of Interest\
61:
62: \b0\fs24 \
63: The purpose of this example is to show you some simple examples of the usage of the DBKit Access Layer:\
64:
65: \pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\b\fc1\cf1 \
66: - How to get connected to the SYBASE server via a default login string
67: \b0 \
68: See the method
69: \b appDidInit:
70: \b0 in the file Controller.m.\
71:
72: \f1\fs28 \
73:
74: \f0\b\fs24 - How to fetch the data from a database using a DBRecordList object
75: \b0 \
76: See the method
77: \b loadCellsFrom:
78: \b0 in the file AddressView.m\
79:
80: \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc1\cf1 \
81: -
82: \b How to view all the values inside a record in a record list using the DBValue object\
83:
84: \b0 See the method
85: \b showInfo:
86: \b0 in the file AddressView.m\
87: \
88: -
89: \b How to add a new record to a database via the DBRecordList object
90: \b0 \
91: See the method
92: \b addRecordFrom:at:
93: \b0 in the file AddressView.m\
94: \
95: -
96: \b How to delete an existing record to a database via the DBRecordList object
97: \b0 \
98: See the method
99: \b deleteSelectedRecord:
100: \b0 in the file AddressView.m\
101: \
102: -
103: \b How to update an existing record to a database via the DBRecordList object
104: \b0 \
105: See the method
106: \b updateRecordFrom:at:
107: \b0 in the file AddressView.m\
108: \
109: -
110: \b How to report the SQL queries generated by the Sybase adaptor via the database delegate method db:willEvaluateString:usingBinder:
111: \b0 \
112: See the file Controller.m\
113:
114: \pard\tx2860\tx2860\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc1\cf1 \
115: \
116:
117: \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\b\fs28\fc1\cf1 Change History
118: \b0\fs24 \
119: May 1992 Upgraded for PR1\
120: August 1992 Upgraded to final 3.0 DBKIT API\
121: June 1993 Upgraded for 3.1
122: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.