isam.cpp Aggiunta funzione per costruire la stringa chiave da un record

isam.h       Aggiunti prototipo funzione precedente
maskfld.h    Aggiunta funzione per settare il modo di trim dei campi
relation.cpp Aggiunto codice di debug nella TRecord_array::remove_from


git-svn-id: svn://10.65.10.50/trunk@2125 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-11-10 13:37:28 +00:00
parent ea5ad0992b
commit 76719be75d
4 changed files with 28 additions and 5 deletions

View File

@ -2099,6 +2099,18 @@ TObject* TRectype::dup() const
return o; return o;
} }
const char* TRectype::build_key(int num) const
{
CBuildKey(rec_des(), num, string(), __tmp_string, TRUE);
return __tmp_string;
}
int TRectype::compare_key(const TRectype& rec, int key) const
{
TString256 key1= build_key(key);
TString256 key2 = rec.build_key(key);
return key1.compare(key2);
}
HIDDEN bool fld_empty(const char* s, int len, bool number) HIDDEN bool fld_empty(const char* s, int len, bool number)
{ {

View File

@ -97,6 +97,10 @@ public:
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
const char* build_key(int key = 1) const;
int compare_key(const TRectype& rec, int key = 1) const;
bool same_key(const TRectype& rec, int key = 1) const { return compare_key(rec, key) == 0; }
const char* get_str(const char* fieldname) const ; const char* get_str(const char* fieldname) const ;
#ifndef FOXPRO #ifndef FOXPRO
const TString& get(const char* fieldname) const ; const TString& get(const char* fieldname) const ;
@ -111,7 +115,6 @@ public:
#endif #endif
TDate get_date(const char* fieldname) const ; TDate get_date(const char* fieldname) const ;
// @DES Put tipizzata // @DES Put tipizzata
// @FPUB // @FPUB

View File

@ -192,6 +192,10 @@ public:
// @cmember Setta lo stato di dirty del campo // @cmember Setta lo stato di dirty del campo
void set_dirty(bool d = TRUE); void set_dirty(bool d = TRUE);
// @cmember abilita il trim degli spazi
void set_trim(bool t)
{ _flags.trim = t; }
// @cmember Setta la giustificazione a destra del campo // @cmember Setta la giustificazione a destra del campo
void set_justify(bool r) void set_justify(bool r)
{ _flags.rightjust = r; } { _flags.rightjust = r; }

View File

@ -1,4 +1,4 @@
// $Id: relation.cpp,v 1.67 1995-11-03 08:18:05 guy Exp $ // $Id: relation.cpp,v 1.68 1995-11-10 13:37:28 guy Exp $
// relation.cpp // relation.cpp
// fv 12/8/93 // fv 12/8/93
// relation class for isam files // relation class for isam files
@ -1774,6 +1774,10 @@ int TRecord_array::remove_from(int pos) const
rec->put(_num, pos); rec->put(_num, pos);
for (int e = rec->read(f, _isgteq); e == NOERR && *rec == key(); e = rec->next(f)) for (int e = rec->read(f, _isgteq); e == NOERR && *rec == key(); e = rec->next(f))
{ {
#ifdef DBG
TString k_rec = rec->build_key();
TString k_key = key().build_key();
#endif
const int found = rec->get_int(_num); const int found = rec->get_int(_num);
if (found >= pos) if (found >= pos)
{ {