kpilot/lib

PilotLocalDatabase Class Reference

Inheritance diagram for PilotLocalDatabase:

PilotDatabase List of all members.

Detailed Description

Definition at line 34 of file pilotLocalDatabase.h.


Public Member Functions

 PilotLocalDatabase (const QString &path, const QString &name, bool useDefaultPath=true)
 PilotLocalDatabase (const QString &name, bool useConduitDBs)
 PilotLocalDatabase (const QString &name)
virtual ~PilotLocalDatabase ()
virtual bool createDatabase (long creator=0, long type=0, int cardno=0, int flags=0, int version=0)
virtual int deleteDatabase ()
virtual int readAppBlock (unsigned char *buffer, int maxLen)
virtual int writeAppBlock (unsigned char *buffer, int len)
virtual int recordCount ()
virtual QValueList< recordid_t > idList ()
virtual PilotRecordreadRecordById (recordid_t id)
virtual PilotRecordreadRecordByIndex (int index)
virtual PilotRecordreadNextRecInCategory (int category)
const PilotRecordfindNextNewRecord ()
virtual PilotRecordreadNextModifiedRec (int *ind=0L)
virtual recordid_t writeRecord (PilotRecord *newRecord)
virtual int deleteRecord (recordid_t id, bool all=false)
virtual int resetSyncFlags ()
virtual int resetDBIndex ()
virtual int cleanup ()
virtual recordid_t updateID (recordid_t id)
QString getDBName () const
virtual QString dbPathName () const
int appInfoSize () const
char * appInfo ()
DBInfo & getDBInfo () const
void setDBInfo (const struct DBInfo &dbi)
virtual DBType dbType () const

Static Public Member Functions

static void setDBPath (const QString &)
static const QString * getDBPath ()

Protected Member Functions

void fixupDBName ()
virtual void openDatabase ()
virtual void closeDatabase ()

Constructor & Destructor Documentation

PilotLocalDatabase::PilotLocalDatabase ( const QString &  path,
const QString &  name,
bool  useDefaultPath = true 
)

Opens the local database.

If the database cannot be found at the given position, a default path is used ($KDEHOME/share/apps/kpilot/DBBackup) and if the file is found there, it is opened. In some cases this should not be done, so the parameter useDefaultPath controls this behavior. If it is set to true, the default path is used if the file cannot be found in the explicitly given location. If it is set to false and the database cannot be found, no database is opened. It can then be created explicitly at the specified location.

Definition at line 81 of file pilotLocalDatabase.cc.

PilotLocalDatabase::PilotLocalDatabase ( const QString &  name,
bool  useConduitDBs 
)

Opens the local database.

A default path is used ($KDEHOME/share/apps/kpilot/DBBackup) and if the file is found there, it is opened. Since a backup messes up the state of the conduits (i.e. changes on the handheld might no longer be detected after a backup run, since the conduit assumes the database to have the state of the previous conduit run, useConduitDBs=true opens the database in $KDEHOME/share/apps/kpilot/conduits

TODO: Deprecate this one.

Definition at line 115 of file pilotLocalDatabase.cc.

PilotLocalDatabase::PilotLocalDatabase ( const QString &  name  ) 

Opens the local database.

This is primarily for testing purposes; only tries the given path.

Definition at line 141 of file pilotLocalDatabase.cc.


Member Function Documentation

int PilotLocalDatabase::appInfoSize (  )  const [inline]

Accessor functions for the application info block.

Definition at line 154 of file pilotLocalDatabase.h.

int PilotLocalDatabase::cleanup (  )  [virtual]

Purges all Archived/Deleted records from Palm Pilot database.

Implements PilotDatabase.

Definition at line 554 of file pilotLocalDatabase.cc.

bool PilotLocalDatabase::createDatabase ( long  creator = 0,
long  type = 0,
int  cardno = 0,
int  flags = 0,
int  version = 0 
) [virtual]

Creates the database with the given creator, type and flags on the given card (default is RAM).

If the database already exists, this function does nothing.

Implements PilotDatabase.

Definition at line 182 of file pilotLocalDatabase.cc.

QString PilotLocalDatabase::dbPathName (  )  const [virtual]

Returns the full path of the current database, based on the path and dbname passed to the constructor, and including the .pdb extension.

Implements PilotDatabase.

Definition at line 586 of file pilotLocalDatabase.cc.

int PilotLocalDatabase::deleteDatabase (  )  [virtual]

Deletes the database (by name, as given in the constructor and stored in the fDBName field.

)

Implements PilotDatabase.

Definition at line 223 of file pilotLocalDatabase.cc.

int PilotLocalDatabase::deleteRecord ( recordid_t  id,
bool  all = false 
) [virtual]

Deletes a record with the given recordid_t from the database, or all records, if all is set to true.

The recordid_t will be ignored in this case. Return value is negative on error, 0 otherwise.

Implements PilotDatabase.

Definition at line 486 of file pilotLocalDatabase.cc.

const PilotRecord * PilotLocalDatabase::findNextNewRecord (  ) 

Returns the next "new" record, ie.

the next record that has not been synced yet. These records all have ID=0, so are not easy to find with the other methods. The record is the one contained in the database, not a copy like the read*() functions give you -- so be careful with it. Don't delete it, in any case. Casting it to non-const and marking it deleted is OK, though, which is mostly its intended use.

Definition at line 368 of file pilotLocalDatabase.cc.

QString PilotLocalDatabase::getDBName (  )  const [inline]

Return the name of the database (as it would be on the handheld).

Definition at line 142 of file pilotLocalDatabase.h.

QValueList< recordid_t > PilotLocalDatabase::idList (  )  [virtual]

Returns a QValueList of all record ids in the database.

This implementation is really bad.

Reimplemented from PilotDatabase.

Definition at line 282 of file pilotLocalDatabase.cc.

int PilotLocalDatabase::readAppBlock ( unsigned char *  buffer,
int  maxLen 
) [virtual]

Reads the application block info, returns size.

Implements PilotDatabase.

Definition at line 239 of file pilotLocalDatabase.cc.

PilotRecord * PilotLocalDatabase::readNextModifiedRec ( int *  ind = 0L  )  [virtual]

Reads the next record from database that has the dirty flag set.

ind (if a valid pointer is given) will receive the index of the returned record.

Implements PilotDatabase.

Definition at line 395 of file pilotLocalDatabase.cc.

PilotRecord * PilotLocalDatabase::readNextRecInCategory ( int  category  )  [virtual]

Reads the next record from database in category 'category'.

Implements PilotDatabase.

Definition at line 344 of file pilotLocalDatabase.cc.

PilotRecord * PilotLocalDatabase::readRecordById ( recordid_t  id  )  [virtual]

Reads a record from database by id, returns record length.

Implements PilotDatabase.

Definition at line 298 of file pilotLocalDatabase.cc.

PilotRecord * PilotLocalDatabase::readRecordByIndex ( int  index  )  [virtual]

Reads a record from database, returns the record length.

Implements PilotDatabase.

Definition at line 323 of file pilotLocalDatabase.cc.

int PilotLocalDatabase::recordCount (  )  [virtual]

returns the number of records in the database

Implements PilotDatabase.

Definition at line 275 of file pilotLocalDatabase.cc.

int PilotLocalDatabase::resetDBIndex (  )  [virtual]

Resets next record index to beginning.

Implements PilotDatabase.

Definition at line 541 of file pilotLocalDatabase.cc.

int PilotLocalDatabase::resetSyncFlags (  )  [virtual]

Resets all records in the database to not dirty.

Implements PilotDatabase.

Definition at line 523 of file pilotLocalDatabase.cc.

void PilotLocalDatabase::setDBPath ( const QString &   )  [static]

For databases opened by name only (constructor 2 -- which is the preferred one, too) try this path first before the default path.

Set statically so it's shared for all local databases.

Definition at line 700 of file pilotLocalDatabase.cc.

recordid_t PilotLocalDatabase::updateID ( recordid_t  id  )  [virtual]

Update the ID of the current record in the database with the specified.

Parameters:
id . This is allowed only after reading or writing a modified or new record.

Definition at line 424 of file pilotLocalDatabase.cc.

int PilotLocalDatabase::writeAppBlock ( unsigned char *  buffer,
int  len 
) [virtual]

Writes the application block info.

Implements PilotDatabase.

Definition at line 256 of file pilotLocalDatabase.cc.

recordid_t PilotLocalDatabase::writeRecord ( PilotRecord newRecord  )  [virtual]

Writes a new record to database (if 'id' == 0, one will be assigned to newRecord).

Implements PilotDatabase.

Definition at line 445 of file pilotLocalDatabase.cc.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys