The Sales Conduit

With all this information on hand regarding the conduit’s role of moving data to and from the handheld, it is time to return to the Sales conduit. We will extend it so that our shell from the previous chapter also supports “Desktop overwrites handheld” and “Handheld overwrites desktop.” We are postponing full syncing until Chapter 16.

For our conduit, we’ve got to define what it means to do each type of overwriting. Here’s the logic that we think makes sense for the Sales application:

Desktop overwrites handheld

The products database and the customers database are completely overwritten from the desktop; nothing happens to the orders database.

Handheld overwrites database

The products are ignored (since they can’t have changed on the handheld). The customers and orders databases are copied to the desktop. Any archived customers are appended to a separate file; deleted customers are removed from the handheld.

The end result is that the customer database is moved both to and from the handheld. The product database is sent to the handheld and the order database is sent to the desktop. Figure 15-2 shows you where each type of data is moving.

Where data is moving between the desktop and the handheld
Figure 15-2. Where data is moving between the desktop and the handheld

Format Used to Store Data on the Desktop

We store data on the desktop as tab-delimited text files.

The customers will be stored in a file named Customers.txt ...

Get Palm OS Programming, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.