00001
#ifndef _KPILOT_PILOTLOCALDATABASE_H
00002
#define _KPILOT_PILOTLOCALDATABASE_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
#include <time.h>
00034
00035
#ifndef _PILOT_MACROS_H_
00036
#include <pi-macros.h>
00037
#endif
00038
00039
#ifndef _KPILOT_PILOTDATABASE_H
00040
#include "pilotDatabase.h"
00041
#endif
00042
00043
class PilotLocalDatabase :
public PilotDatabase
00044 {
00045
public:
00056 PilotLocalDatabase(
const QString& path,
00057
const QString& name,
bool useDefaultPath=
true,
00058 QObject *p=0L,
const char *n=0L);
00069 PilotLocalDatabase(
const QString &name,
bool useConduitDBs=
false,
00070 QObject *p=0L,
const char *n=0L);
00071
00072
00073
virtual ~PilotLocalDatabase();
00074
00076
virtual bool createDatabase(
long creator=0,
long type=0,
int cardno=0,
int flags=0,
int version=0);
00078
virtual int deleteDatabase();
00079
00080
virtual int readAppBlock(
unsigned char* buffer,
int maxLen);
00081
00082
virtual int writeAppBlock(
unsigned char* buffer,
int len);
00083
00084
virtual int recordCount();
00085
00086
virtual QValueList<recordid_t>
idList();
00087
00088
virtual PilotRecord* readRecordById(recordid_t
id);
00089
00090
virtual PilotRecord* readRecordByIndex(
int index);
00091
00092
virtual PilotRecord* readNextRecInCategory(
int category);
00098
virtual PilotRecord* readNextModifiedRec(
int *ind=NULL);
00099
00100
virtual recordid_t writeRecord(PilotRecord* newRecord);
00106
virtual int deleteRecord(recordid_t
id,
bool all=
false);
00107
00108
virtual int resetSyncFlags();
00109
00110
virtual int resetDBIndex();
00111
00112
virtual int cleanup();
00113
00114
00115
00116
virtual recordid_t writeID(PilotRecord* rec);
00117 QString getDBName()
const {
return fDBName; }
00118
00124
virtual QString
dbPathName() const;
00125
00129
int appInfoSize()
const
00130
{
if (isDBOpen())
return fAppLen;
else return -1; } ;
00131
char *appInfo() {
return fAppInfo; } ;
00132
00133
struct DBInfo getDBInfo() const {
return fDBInfo; }
00134
void setDBInfo(
struct DBInfo dbi) {fDBInfo=dbi; }
00135
00136
protected:
00137
00138
void fixupDBName();
00139
virtual void openDatabase();
00140
virtual void closeDatabase();
00141
00142
private:
00143
struct DBInfo fDBInfo;
00144 QString fPathName,fDBName;
00145
char* fAppInfo;
00146
int fAppLen;
00147
int fNumRecords;
00148
int fCurrentRecord;
00149 PilotRecord* fRecords[10000];
00150
int fPendingRec;
00151
00152
00158
public:
00159
static void setDBPath(
const QString &);
00160
static const QString *getDBPath() {
return fPathBase; } ;
00161
private:
00162
static QString *fPathBase;
00163 };
00164
00165
#endif