Apple Network Setup Network Card User Manual


 
CHAPTER 2
Using Network Setup
48 Working with Sets
printf("User-visible name of active TCP/IP entity = "%#s"\n",
userVisibleName);
}
MyCloseDatabaseAfterReading(dbRef, readArea);
}
if (err != noErr) {
printf("Failed with error %ld.\n", err);
}
}
Areas and Sets 2
When working with sets you need to be very careful about area identifiers.
There are three key points to remember:
The area identifier is embedded in the entity reference.
All modifications to the database are done in a temporary area.
The temporary area is destroyed when changes are committed to the
database.
So, the area identifier that is embedded in the entity reference in a set is an area
identifier for an area that no longer exists. This can cause your software to fail.
For example, consider the following sequence:
1. Start with a database whose default area identifier is 1370.
2. A program opens the database for writing, which creates a temporary area
whose identifier is 6288.
3. The program adds an entity reference to the active set entity in the temporary
area. Because the added entity reference describes an entity in the temporary
area, its area identifier is 6288.
4. The writing program commits its changes to the database, overwriting area
1370 with the content of area 6288. The active set entity in area 1370 now
contains an entity reference whose area identifier is 6288.
5. Your program opens the database for reading. It then opens the active set
entity and reads the entity references contained therein. When it tries to use
one of those entities, the program fails because the entity’s area identifier is
6288, not 1370.