Reference

DlpOpenDB(3)

elementary operations on Palm databases

NAME

DlpOpenDB, DlpCreateDB, DlpCloseDB, DlpDeleteDB – elementary operations on Palm databases

LIBRARY

libpconn

SYNOPSIS

#include <palm.h>

#include <pconn/pconn.h>

int

DlpOpenDB(PConnection *pconn, int card, const char *name, ubyte mode, ubyte *dbhandle);

int

DlpCreateDB(PConnection *pconn, const struct dlp_createdbreq *newdb, ubyte *dbhandle);

int

DlpCloseDB(PConnection *pconn, ubyte dbhandle);

int

DlpDeleteDB(PConnection *pconn, const int card, const char *name);

DESCRIPTION

DlpOpenDB opens an existing database on the Palm, similar to opening a file.

card specifies the number of the memory card on which the database is stored. This is usually 0.

name specifies the name of the database to open. It is case-sensitive, and does not include the “.pdb” or “.prc” extension.

mode specifies how to open the database. It is the bitwise-or of one or more of the following:

DLPCMD_MODE_SECRET

Show private records.

DLPCMD_MODE_EXCLUSIVE

I don't know what this does.

DLPCMD_MODE_WRITE

Open database for writing.

DLPCMD_MODE_READ

Open database for reading.

dbhandle is filled in with a database handle, similar to a file descriptor, which will be used to refer to the database in later operations.

DlpCreateDB creates and opens a new database on the Palm.

newdb is the following structure:

struct dlp_createdbreq
{
	udword creator;
	udword type;
	ubyte card;
	uword flags;
	uword version;
	char name[DLPCMD_DBNAME_LEN];
};

where creator and type are four-character constants, with the first character in the most-significant eight bits; card specifies the number of the memory card on which to create the database, usually 0; flags are the same as the flags argument to DlpOpenDB; version is a version number; and name specifies the name of the new database.

dbhandle is filled in with a database handle, as with OpenDB.

DlpCloseDB closes the open database whose handle is dbhandle. If dbhandle is the special value DLPCMD_CLOSEALLDBS, then all open databases are closed.

DlpDeleteDB deletes a database, which must already be closed.

card specifies the number of the memory card on which the database is stored, usually 0.

name specifies the name of the database to delete. It does not include the “.pdb” or “.prc” extension.

RETURN VALUE

These functions all return 0 if they are successful, or a negative value in case of error.

SEE ALSO

libpconn(3).