DBSLib Shared Library
We illustrate shared library implementation with a library that creates databases and populates them with records. The database schema and record data come in the form of an XML string.[58] DBSLib can be used by any conventional Palm application or integrated with an AppForge application using a fuser. We discuss both approaches later in this chapter.
DBSLib parses the XML string to determine the database schema, creates the database, and then adds records according to the schema with data from the XML string. An example of a schema and data in XML format is shown in Example 8-1.
Example 8-1. Database schema and record data in XML format
<Database Name=Employee Type=DATA Creator=AFLD> <Schema> <Field> <Num>0</Num> <Name>FirstName</Name> <Type>6</Type> <Length>0</Length> </Field> <Field> <Num>1</Num> <Name>LastName</Name> <Type>6<Type/> <Length>0</Length> </Field> <Field> <Num>2</Num> <Name>Phone</Name> <Type>6</Type> <Length>0</Length> </Field> </Schema> <Data> <Record> <FirstName>Bob H.</FirstName> <LastName>Smith</LastName> <Phone>(703) 555-1212</Phone> </Record> <Record> <FirstName>Lucy D.</FirstName> <LastName>Anderson</LastName> <Phone>(703) 555-2121</Phone> </Record> </Data> </Database>
DBSLib packages its functionality in a reusable library that other applications can load and use as needed. Applications benefit from using DBSLib because it will work with different schemas and data without being modified. In addition, the XML schema string can come ...
Get Programming Visual Basic for the Palm OS 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.