PDB

From MobileRead

Jump to: navigation, search

PalmOS keeps all RAM storage in a database format. There is no file system in the RAM. When sync'd to a PC these databases will be saved in separate files and this is where the extension is added. All files in device RAM must be in Palm Database format, whether programs or data. The PDB files created for external storage are data files, which can contain arbitrary content.

Contents

[edit] Intro to the Database format

The first record of the database contains attribute information about the database, including the Creator ID, Type, Date Created, Date Modified, Launchable, database (book) name, and other data. Palm database files will generally have a .pdb extension but in some cases they may have a .prc extension (see PRC). The extension doesn't really matter on the Palm device so long as it is one of these two. The launcher will look inside the file to determine its type.

PalmOS programs are expected to have a unique four character "Creator" ID. All data files used by a program will have the same Creator ID as the program that uses them. PalmOS uses the Creator ID to know what data files are used by a program, and what program is used to open any particular data file.

[edit] Intro to PalmDOC

The default text file format on Palm devices is the "PalmDOC" file. This format was originally used by Aportis for their Aportis Reader product. It starts as a plain ASCII text file and is converted using a form of RLE compression to save space in RAM. Available doc readers decompress the file on the fly as they display it. The compression method is "asynchronous" -- it can be decompressed much faster than it can be compressed. Most doc files are created on desktops and synced to the target device, as compressing on the Palm is slow. RLE compression results in an approximate 40% reduction in file size.

Aportis went out of business years ago, and the Aportis Reader is no longer available, but the DOC format was reverse engineered and many reader products can view it. PalmDOC files have a Creator ID of REAd and a Type of TEXt. TealDOC also has a Type of TEXt and it is identical with PalmDOC.

[edit] Intro to zTXT

A newer plain text format for PalmOS is the zTXT file. zTXT files also start as plan ASCII text files, but are then compressed with gzip compatible compression, for an average reduction of 70%. Decompressing the files requires sysZlib.prc, a port of the Zlib library, implemented as a PalmOS shared library. sysZlib is currently used by the LionDoc, PalmFiction, Plucker, and WeaselReader document viewers.

If the PDB file has the Launchable attribute set, an icon for the file will appear in the launcher. The icon will be that of the program with the Creator ID of the PDB file. If the Creator app supports the PalmOS sysAppLaunchCmdOpenDB function, the user can tap on the document icon and invoke the owning program to view/edit the file, similar to the Way windows shortcuts work. Not all programs support this usage, so experimentation is needed to see if it will work.

[edit] Palm Database File Code

A table showing the decode of the various Palm database formats

Reader
Type Code
Adobe Reader.pdfADBE
PalmDOC TEXtREAd
BDictyBVokBDIC
DB (Database program)DB99DBOS
eReaderPNPdPPrs
FireViewer (ImageViewer) vIMGView
HanDBase PmDBPmDB
InfoView InfoINDB
iSilo ToGoToGo
iSilo 3 SDocSilX
JFile JbDbJBas
JFile Pro JfDbJFil
LIST DATALSdb
MobileDB Mdb1Mdb1
MobiPocket BOOKMOBI
Plucker DataPlkr
QuickSheet DataSprd
SuperMemoSM01SMem
TealDoc TEXtTlDc
TealInfo InfoTlIf
TealMeal DataTlMl
TealPaint DataTlPt
ThinkDB dataTDBP
Tides TdatTide
TomeRaider ToRaTRPW
WeaselzTXTGPlm
WordSmith BDOCWrdS

You can usually use a standard text editor to view the file even though it is a binary image. The file type will show up as clear text on the first line. The internal title for the book is also visible on the first line. Be careful not to modify the file when viewing it in this fashion.

[edit] Palm Database Format

A Palm Database is not a file when stored on the Palm in RAM. However it will be stored as a file if it is synced to a computer. The name of that file will always be the database name. The contents of the file will have the following content:

bytescontentcomments
32namedatabase name. This name is 0 terminated in the field and will be used as the file name on a computer.
2attributesbits to mark a file as to backup, launchable, etc.
2versionfile version
4creation dateNo. of seconds since first of year 1904.
4modification date
4last backup date
4appInfoIDoffset to start of Application Info (if present) or null
4sortInfoIDoffset to start of Sort Info (if present) or null
4typeSee above table. (For Applications this data will be 'appl')
4creatorSee above table. This program will be launched if the file is tapped
4uniqueIDseedused internally to identify record
4recordListlist of records or resources, each entry describes its data (next record list (usually 0), number of records in this list, first entry location)
0-?Gap to datatraditionally 2 bytes to Info or raw data

A PDB database entry is a struct that looks like:

  • LocalID - the offset from the start of the PDB to the raw data record (to find the length subtract this start from the next one. The last chunk ends the file.
  • attributes - a byte
  • uniqueID - 3 bytes
Personal tools
MobileRead Networks