---
name: "libpdb"
section: "3"
platform: "linux"
package: "coldsync"
version: "3.0+pre3-3"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/libpdb"
---

# libpdb(3)

library for reading and writing Palm database files

## NAME

**libpdb** – library for reading and writing Palm database files

## SYNOPSIS

**#include \<palm.h\>**

**#include \<pdb.h\>**

Function prototypes are given in their respective man pages.

If

**libpdb** was built with I18N support, you may need to link with *-lintl*

## DESCRIPTION

The **libpdb** library provides functions for reading and writing Palm database files, both PDB (record database) and PRC (resource database).

## INTRODUCTION

A Palm database file has the following overall structure:

- Header.

  This includes the database's name; attribute flags; version; creation, modification, and backup time; modification number; type; creator; and unique ID number seed. It also specifies whether or not the database has an AppInfo and/or sort block.

  The creator field identifies the application with which the database is associated: it will be the same as the creator field of the application database.

- Index header.

- Record/resource index.

  The index lists the locations of records or resources in the database. The index header specifies the number of records in the index, and may optionally point to another index in the database. **libpdb** manages the index and index header.

- Optional AppInfo block.

  The AppInfo block contains application-specific data that pertains to the database as a whole. Typically, it contains category information, as well as user preference settings.

- Optional sort block.

  I'm not sure what this is. I think it specifies the order in which to display the records.

- Records/resources.

## FUNCTIONS

**libpdb** includes the following functions, which are described in their respective manual pages:

*void* **free\_pdb**(*struct pdb \*db*)

*struct* *pdb* *\** **new\_Record**(*const ubyte flags*, *const ubyte category*, *const udword id*, *const uword len*, *const ubyte \*data*)

*struct* *pdb\_resource* *\** **new\_Resource**(*const udword type*, *const uword id*, *const uword len*, *const ubyte \*data*)

*void* **pdb\_FreeRecord**(*struct pdb\_record \*rec*)

*void* **pdb\_FreeResource**(*struct pdb\_resource \*rsrc*)

*struct* *pdb* *\** **pdb\_Read**(*int fd*)

*int* **pdb\_Write**(*const struct pdb \*db*, *int fd*)

*struct* *pdb\_record* *\** **pdb\_FindRecordByID**(*const struct pdb \*db*, *const udword id*)

*struct* *pdb\_record* *\** **pdb\_FindRecordByIndex**(*const struct pdb \*db*, *const uword index*)

*int* **pdb\_DeleteRecordByID**(*struct pdb \*db*, *const udword id*)

*int* **pdb\_AppendRecord**(*struct pdb \*db*, *struct pdb\_record \*newrec*)

*int* **pdb\_AppendResource**(*struct pdb \*db*, *struct pdb\_resource \*newrsrc*)

*int* **pdb\_InsertRecord**(*struct pdb \*db*, *struct pdb\_record \*prev*, *struct pdb\_record \*newrec*)

*int* **pdb\_InsertResource**(*struct pdb \*db*, *struct pdb\_resource \*prev*, *struct pdb\_resource \*newrsrc*)

*struct* *pdb\_record* *\** **new\_Record**(*const ubyte attributes*, *const ubyte category*, *const udword id*, *const uword len*, *const ubyte \*data*)

*struct* *pdb\_record* *\** **pdb\_CopyRecord**(*const struct pdb \*db*, *const struct pdb\_record \*rec*)

*struct* *pdb\_resource* *\** **pdb\_CopyResource**(*const struct pdb \*db*, *const struct pdb\_resource \*rsrc*)

*int* **pdb\_LoadHeader**(*int fd*, *struct pdb \*db*)

## AUTHORS

Andrew Arensburger ⟨arensb@ooblick.com⟩

## LIMITATIONS

Does not support multiple indexes in one database.
