Apple Network Setup manual Areas and Sets

Models: Network Setup

1 184
Download 184 pages 5.56 Kb
Page 48
Image 48
Areas and Sets

C H A P T E R 2

Using Network Setup

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

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.

48Working with Sets

Page 48
Image 48
Apple Network Setup manual Areas and Sets