Aggiunte le funzioni rewriteat.
git-svn-id: svn://10.65.10.50/trunk@46 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
441344d49c
commit
94b43f2779
126
include/isam.h
126
include/isam.h
@ -52,30 +52,30 @@ class TExtrectype;
|
|||||||
|
|
||||||
class TRectype : public TSortable
|
class TRectype : public TSortable
|
||||||
{
|
{
|
||||||
friend class TExtrectype;
|
friend class TExtrectype;
|
||||||
friend class TRecfield;
|
friend class TRecfield;
|
||||||
friend class TBaseisamfile;
|
friend class TBaseisamfile;
|
||||||
friend class TLocalisamfile;
|
friend class TLocalisamfile;
|
||||||
friend class TIsamtempfile;
|
friend class TIsamtempfile;
|
||||||
|
|
||||||
// DPRIV
|
// DPRIV
|
||||||
char* _rec; // Puntatore a inizio record
|
char* _rec; // Puntatore a inizio record
|
||||||
int _logicnum; // Numero logico
|
int _logicnum; // Numero logico
|
||||||
int _length; // Lunghezza
|
int _length; // Lunghezza
|
||||||
isdef* _i; // Puntatore al file isam
|
isdef* _i; // Puntatore al file isam
|
||||||
bool _isempty; // Se il record e' vuoto
|
bool _isempty; // Se il record e' vuoto
|
||||||
// @END
|
// @END
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// FPROT
|
// FPROT
|
||||||
const char* start(int nf) const;
|
const char* start(int nf) const;
|
||||||
void setempty(bool val) { _isempty = val;} // Rende vero is_empty
|
void setempty(bool val) { _isempty = val;} // Rende vero is_empty
|
||||||
virtual TObject* dup() const; // Duplica record
|
virtual TObject* dup() const; // Duplica record
|
||||||
virtual int compare(const TSortable& s) const;
|
virtual int compare(const TSortable& s) const;
|
||||||
// @END
|
// @END
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// FPUB
|
// FPUB
|
||||||
int items() const;
|
int items() const;
|
||||||
void setdirty() { setempty(FALSE); }
|
void setdirty() { setempty(FALSE); }
|
||||||
char* string() const { return _rec;} // Ritorna il puntatore all'inizio. NON dovrebbe essere usata!
|
char* string() const { return _rec;} // Ritorna il puntatore all'inizio. NON dovrebbe essere usata!
|
||||||
@ -90,8 +90,8 @@ protected:
|
|||||||
bool exist(const char* fieldname) const; // Ritorna l'esistenza del campo
|
bool exist(const char* fieldname) const; // Ritorna l'esistenza del campo
|
||||||
const char* fieldname(int i) const; // Ritorna il nome del campo i
|
const char* fieldname(int i) const; // Ritorna il nome del campo i
|
||||||
|
|
||||||
// @DES Get tipizzata. Ritorna il contenuto del campo nei vari tipi
|
// @DES Get tipizzata. Ritorna il contenuto del campo nei vari tipi
|
||||||
// @FPUB
|
// @FPUB
|
||||||
#ifndef FOXPRO
|
#ifndef FOXPRO
|
||||||
int get_int(const char* fieldname) const ;
|
int get_int(const char* fieldname) const ;
|
||||||
long get_long(const char* fieldname) const ;
|
long get_long(const char* fieldname) const ;
|
||||||
@ -102,12 +102,12 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
TDate get_date(const char* fieldname) const ;
|
TDate get_date(const char* fieldname) const ;
|
||||||
|
|
||||||
// @DES Get non tipizzata. Il campo e' ritornato come TString&
|
// @DES Get non tipizzata. Il campo e' ritornato come TString&
|
||||||
// @FPUB
|
// @FPUB
|
||||||
const TString& get(const char* fieldname) const ;
|
const TString& get(const char* fieldname) const ;
|
||||||
|
|
||||||
// @DES Put tipizzata
|
// @DES Put tipizzata
|
||||||
// @FPUB
|
// @FPUB
|
||||||
|
|
||||||
#ifndef FOXPRO
|
#ifndef FOXPRO
|
||||||
void put(const char* fieldname, int val);
|
void put(const char* fieldname, int val);
|
||||||
@ -119,10 +119,10 @@ protected:
|
|||||||
void put(const char* fieldname, const real& val);
|
void put(const char* fieldname, const real& val);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// @DES Put NON tipizzata
|
// @DES Put NON tipizzata
|
||||||
// @FPUB
|
// @FPUB
|
||||||
void put(const char* fieldname, const char* val);
|
void put(const char* fieldname, const char* val);
|
||||||
// void put(const char* fieldname, TString& val);
|
// void put(const char* fieldname, TString& val);
|
||||||
|
|
||||||
void zero(const char * fieldname); // Vuota campo puntato da fieldname
|
void zero(const char * fieldname); // Vuota campo puntato da fieldname
|
||||||
void zero(); // Vuota tutto il record
|
void zero(); // Vuota tutto il record
|
||||||
@ -155,7 +155,7 @@ protected:
|
|||||||
|
|
||||||
class TBaseisamfile : public TObject
|
class TBaseisamfile : public TObject
|
||||||
{
|
{
|
||||||
// @DPRIV
|
// @DPRIV
|
||||||
isdef* _isamfile; // Descrittore file isam
|
isdef* _isamfile; // Descrittore file isam
|
||||||
int _logicnum; // Numero logico del record corrente
|
int _logicnum; // Numero logico del record corrente
|
||||||
int _lasterr; // Ultimo errore
|
int _lasterr; // Ultimo errore
|
||||||
@ -173,9 +173,9 @@ class TBaseisamfile : public TObject
|
|||||||
friend class TIsamfile;
|
friend class TIsamfile;
|
||||||
friend class TIsamtempfile;
|
friend class TIsamtempfile;
|
||||||
friend class TRecfield;
|
friend class TRecfield;
|
||||||
// friend class TCursor;
|
// friend class TCursor;
|
||||||
// @END
|
// @END
|
||||||
// @FPRIV
|
// @FPRIV
|
||||||
// friend TRecnotype __buildcursor(TFilecursor* tic, TRecnotype rp);
|
// friend TRecnotype __buildcursor(TFilecursor* tic, TRecnotype rp);
|
||||||
// friend TRecnotype __filtercursor(TFilecursor* tic);
|
// friend TRecnotype __filtercursor(TFilecursor* tic);
|
||||||
// friend bool __evalcondition(TBaseisamfile* i,TString& condition);
|
// friend bool __evalcondition(TBaseisamfile* i,TString& condition);
|
||||||
@ -186,16 +186,16 @@ class TBaseisamfile : public TObject
|
|||||||
int rewhr(const TRectype& rec, TDate& atdate);
|
int rewhr(const TRectype& rec, TDate& atdate);
|
||||||
int delhr(const TRectype& rec, TDate& atdate);
|
int delhr(const TRectype& rec, TDate& atdate);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// @FPROT
|
// @FPROT
|
||||||
isdef** ptrfilehnd() const { return (isdef**) &_isamfile;}
|
isdef** ptrfilehnd() const { return (isdef**) &_isamfile;}
|
||||||
void clearfilehnd() { _isamfile = NULL;}
|
void clearfilehnd() { _isamfile = NULL;}
|
||||||
int _open(unsigned int mode = _manulock); // Apre isam file con lock
|
int _open(unsigned int mode = _manulock); // Apre isam file con lock
|
||||||
int _close();
|
int _close();
|
||||||
const char* filename() const;
|
const char* filename() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @FPUB
|
||||||
void setkey(int nkey); // Attiva una chiave
|
void setkey(int nkey); // Attiva una chiave
|
||||||
int getkey() const; // Ritorna la chiave
|
int getkey() const; // Ritorna la chiave
|
||||||
void setstatus(int status) { _lasterr = status;} // Setta _lasterr
|
void setstatus(int status) { _lasterr = status;} // Setta _lasterr
|
||||||
@ -216,6 +216,8 @@ class TBaseisamfile : public TObject
|
|||||||
virtual int write(const TRectype& rec, TDate& atdate = botime);
|
virtual int write(const TRectype& rec, TDate& atdate = botime);
|
||||||
virtual int rewrite(TDate& atdate = botime);
|
virtual int rewrite(TDate& atdate = botime);
|
||||||
virtual int rewrite(const TRectype& rec, TDate& atdate = botime);
|
virtual int rewrite(const TRectype& rec, TDate& atdate = botime);
|
||||||
|
virtual int rewriteat(TRecnotype nrec);
|
||||||
|
virtual int rewriteat(const TRectype& rec, TRecnotype nrec);
|
||||||
virtual int remove(TDate& atdate = botime);
|
virtual int remove(TDate& atdate = botime);
|
||||||
virtual int remove(const TRectype& rec, TDate& atdate = botime);
|
virtual int remove(const TRectype& rec, TDate& atdate = botime);
|
||||||
virtual const char* name() const;
|
virtual const char* name() const;
|
||||||
@ -239,8 +241,8 @@ class TBaseisamfile : public TObject
|
|||||||
|
|
||||||
long items() const; // n.o di records nel file
|
long items() const; // n.o di records nel file
|
||||||
|
|
||||||
// @DES Get tipizzata. Ritorna il contenuto del campo nei vari tipi
|
// @DES Get tipizzata. Ritorna il contenuto del campo nei vari tipi
|
||||||
// @FPUB
|
// @FPUB
|
||||||
#ifndef FOXPRO
|
#ifndef FOXPRO
|
||||||
int get_int(const char* fieldname) const
|
int get_int(const char* fieldname) const
|
||||||
{ return curr().get_int(fieldname);}
|
{ return curr().get_int(fieldname);}
|
||||||
@ -258,13 +260,13 @@ class TBaseisamfile : public TObject
|
|||||||
TDate get_date(const char* fieldname) const
|
TDate get_date(const char* fieldname) const
|
||||||
{ return curr().get_date(fieldname);}
|
{ return curr().get_date(fieldname);}
|
||||||
|
|
||||||
// @DES Get non tipizzata. Il campo e' ritornato come TString&
|
// @DES Get non tipizzata. Il campo e' ritornato come TString&
|
||||||
// @FPUB
|
// @FPUB
|
||||||
const TString& get(const char* fieldname) const
|
const TString& get(const char* fieldname) const
|
||||||
{ return curr().get(fieldname);}
|
{ return curr().get(fieldname);}
|
||||||
|
|
||||||
// @DES Put NON tipizzata
|
// @DES Put NON tipizzata
|
||||||
// @FPUB
|
// @FPUB
|
||||||
#ifndef FOXPRO
|
#ifndef FOXPRO
|
||||||
void put(const char* fieldname, int val)
|
void put(const char* fieldname, int val)
|
||||||
{ curr().put(fieldname, val);}
|
{ curr().put(fieldname, val);}
|
||||||
@ -282,8 +284,8 @@ class TBaseisamfile : public TObject
|
|||||||
{ curr().put(fieldname, val);}
|
{ curr().put(fieldname, val);}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// @DES Put NON tipizzata
|
// @DES Put NON tipizzata
|
||||||
// @FPUB
|
// @FPUB
|
||||||
void put(const char* fieldname, const char* val)
|
void put(const char* fieldname, const char* val)
|
||||||
{ curr().put(fieldname, val);}
|
{ curr().put(fieldname, val);}
|
||||||
|
|
||||||
@ -305,8 +307,8 @@ class TBaseisamfile : public TObject
|
|||||||
|
|
||||||
class TIsamfile : public TBaseisamfile
|
class TIsamfile : public TBaseisamfile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @FPUB
|
||||||
int flags(bool updateeod = FALSE);
|
int flags(bool updateeod = FALSE);
|
||||||
int open(unsigned int mode = _manulock) { return _open(mode);} // Apre isam file con lock
|
int open(unsigned int mode = _manulock) { return _open(mode);} // Apre isam file con lock
|
||||||
int close() { return _close();}
|
int close() { return _close();}
|
||||||
@ -323,8 +325,8 @@ class TIsamfile : public TBaseisamfile
|
|||||||
|
|
||||||
class TIsamtempfile : public TBaseisamfile
|
class TIsamtempfile : public TBaseisamfile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @FPUB
|
||||||
int open(char* radix, bool create = TRUE, TRecnotype eod = 0,
|
int open(char* radix, bool create = TRUE, TRecnotype eod = 0,
|
||||||
TRecnotype eox = 100); // Apre il file. radix e' la radice del path del file, se create e' falso vuol dire che il file esiste gia', e allora eod dice quanti record ci sono; eox quanti bisogna aggiungerne
|
TRecnotype eox = 100); // Apre il file. radix e' la radice del path del file, se create e' falso vuol dire che il file esiste gia', e allora eod dice quanti record ci sono; eox quanti bisogna aggiungerne
|
||||||
|
|
||||||
@ -341,8 +343,8 @@ class TIsamtempfile : public TBaseisamfile
|
|||||||
|
|
||||||
class TSystemisamfile : public TIsamfile
|
class TSystemisamfile : public TIsamfile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @FPUB
|
||||||
int build(TRecnotype eox); // Costruisce un file isam
|
int build(TRecnotype eox); // Costruisce un file isam
|
||||||
int extend(TRecnotype eox); // Estende un file preesistente
|
int extend(TRecnotype eox); // Estende un file preesistente
|
||||||
long size(TRecnotype eox); // Calcola lo spazio che il file occuperebbe se venisse esteso a eox
|
long size(TRecnotype eox); // Calcola lo spazio che il file occuperebbe se venisse esteso a eox
|
||||||
@ -351,10 +353,10 @@ class TSystemisamfile : public TIsamfile
|
|||||||
int packfile(bool vis = TRUE); // Rimuove fisicamente i record cancellati
|
int packfile(bool vis = TRUE); // Rimuove fisicamente i record cancellati
|
||||||
int packindex(bool vis = TRUE); // La stessa cosa sugli indici
|
int packindex(bool vis = TRUE); // La stessa cosa sugli indici
|
||||||
|
|
||||||
// @DES Importa un file ascii. from e' il nome del file da importare
|
// @DES Importa un file ascii. from e' il nome del file da importare
|
||||||
int load(const char* from, char fs = '|', char fd = '\0', char rs = '\n', bool vis = TRUE) ;
|
int load(const char* from, char fs = '|', char fd = '\0', char rs = '\n', bool vis = TRUE) ;
|
||||||
|
|
||||||
// @DES Esporta VERSO un file ascii.
|
// @DES Esporta VERSO un file ascii.
|
||||||
int dump(const char* to, int nkey = 1, char fs = '|', char fd = '\0', char rs = '\n', bool vis = TRUE, bool withdeleted = FALSE);
|
int dump(const char* to, int nkey = 1, char fs = '|', char fd = '\0', char rs = '\n', bool vis = TRUE, bool withdeleted = FALSE);
|
||||||
|
|
||||||
TSystemisamfile(int logicnum, bool linkrecinst = TRUE);
|
TSystemisamfile(int logicnum, bool linkrecinst = TRUE);
|
||||||
@ -368,12 +370,12 @@ class TSystemisamfile : public TIsamfile
|
|||||||
|
|
||||||
class TLocalisamfile : public TBaseisamfile
|
class TLocalisamfile : public TBaseisamfile
|
||||||
{
|
{
|
||||||
// @DPRIV
|
// @DPRIV
|
||||||
bool _was_open; // Vero se il file e' stato aperto come Localisamfile
|
bool _was_open; // Vero se il file e' stato aperto come Localisamfile
|
||||||
bool _isatab; // Vero se il file e' una tabella
|
bool _isatab; // Vero se il file e' una tabella
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @FPUB
|
||||||
virtual int operator +=(const TRecnotype npos); // Avanza npos record
|
virtual int operator +=(const TRecnotype npos); // Avanza npos record
|
||||||
virtual int operator -=(const TRecnotype npos); // Sposta indietro di npos
|
virtual int operator -=(const TRecnotype npos); // Sposta indietro di npos
|
||||||
virtual int operator ++(); // record successivo
|
virtual int operator ++(); // record successivo
|
||||||
@ -383,7 +385,7 @@ class TLocalisamfile : public TBaseisamfile
|
|||||||
|
|
||||||
int open(unsigned int mode = _manulock);
|
int open(unsigned int mode = _manulock);
|
||||||
int close() ;
|
int close() ;
|
||||||
// Costruttore. linkrecinst dice se il file deve utilizzare un area record separata oppure la stessa.
|
// Costruttore. linkrecinst dice se il file deve utilizzare un area record separata oppure la stessa.
|
||||||
TLocalisamfile(int logicnum, bool linkrecinst = TRUE);
|
TLocalisamfile(int logicnum, bool linkrecinst = TRUE);
|
||||||
virtual ~TLocalisamfile();
|
virtual ~TLocalisamfile();
|
||||||
};
|
};
|
||||||
@ -395,8 +397,8 @@ class TLocalisamfile : public TBaseisamfile
|
|||||||
|
|
||||||
class TRec_array : public TArray
|
class TRec_array : public TArray
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @FPUB
|
||||||
TRec_array(int dimension, TBaseisamfile& i);
|
TRec_array(int dimension, TBaseisamfile& i);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -407,22 +409,22 @@ class TRec_array : public TArray
|
|||||||
|
|
||||||
class TRecfield : public TObject
|
class TRecfield : public TObject
|
||||||
{
|
{
|
||||||
// @DPRIV
|
// @DPRIV
|
||||||
char _name[12]; // Nome campo
|
char _name[12]; // Nome campo
|
||||||
TRectype* _rec; // Puntatore a inizio record
|
TRectype* _rec; // Puntatore a inizio record
|
||||||
char* _p; // Puntatore a inizio campo
|
char* _p; // Puntatore a inizio campo
|
||||||
byte _len; // Lunghezza campo
|
byte _len; // Lunghezza campo
|
||||||
byte _dec; // Numero di decimali
|
byte _dec; // Numero di decimali
|
||||||
byte _type; // Tipo del campo
|
byte _type; // Tipo del campo
|
||||||
// @END
|
// @END
|
||||||
|
|
||||||
// @FPRIV
|
// @FPRIV
|
||||||
void set(int from, int to);
|
void set(int from, int to);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @FPUB
|
||||||
// @DES Operatore di assegnazione (=) per i vari tipi
|
// @DES Operatore di assegnazione (=) per i vari tipi
|
||||||
// @FPUB
|
// @FPUB
|
||||||
|
|
||||||
int operator =(int i) ;
|
int operator =(int i) ;
|
||||||
long operator =(long l) ;
|
long operator =(long l) ;
|
||||||
@ -432,8 +434,8 @@ class TRecfield : public TObject
|
|||||||
const real& operator =(const real& r) ;
|
const real& operator =(const real& r) ;
|
||||||
#endif // FOXPRO
|
#endif // FOXPRO
|
||||||
|
|
||||||
// @DES Operatore di estrazione per i vari tipi
|
// @DES Operatore di estrazione per i vari tipi
|
||||||
// @FPUB
|
// @FPUB
|
||||||
operator int() const ;
|
operator int() const ;
|
||||||
operator long() const ;
|
operator long() const ;
|
||||||
operator const char*() const ;
|
operator const char*() const ;
|
||||||
@ -462,15 +464,15 @@ class TRecfield : public TObject
|
|||||||
|
|
||||||
class TTransaction
|
class TTransaction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @FPUB
|
||||||
void begin();
|
void begin();
|
||||||
void end(bool success = TRUE);
|
void end(bool success = TRUE);
|
||||||
void abort() { end(FALSE);}
|
void abort() { end(FALSE);}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __ISAM_CPP
|
#ifdef __ISAM_CPP
|
||||||
#define extern
|
#define extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// @DPUB
|
// @DPUB
|
||||||
|
Loading…
x
Reference in New Issue
Block a user