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;
}
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)
{

View File

@ -97,6 +97,10 @@ public:
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* 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 ;
#ifndef FOXPRO
const TString& get(const char* fieldname) const ;
@ -111,7 +115,6 @@ public:
#endif
TDate get_date(const char* fieldname) const ;
// @DES Put tipizzata
// @FPUB
@ -135,7 +138,7 @@ public:
void zero(); // Vuota tutto il record
void zero(char c); // Vuota tutto il record usando il carattere c
void blank(const char * fieldname) { put(fieldname, " "); } // Riempie il campo di spazi
void blank(const char * fieldname) { put(fieldname, " "); } // Riempie il campo di spazi
TRectype& operator =(const TRectype& rec); // assegnazione tra TRectype
TRectype& operator =(const char* rec); // assegnazione tra TRectype
@ -309,7 +312,7 @@ public:
void zero(const char * fieldname) { curr().zero(fieldname);}
void zero() { curr().zero();}
void zero(char c) { curr().zero(c);}
void blank(const char * fieldname) { curr().blank(fieldname); }
void blank(const char * fieldname) { curr().blank(fieldname); }
TRectype& operator =(const TRectype& rec) { return curr() = rec;}
TBaseisamfile(int logicnum, bool linkrecinst = FALSE);

View File

@ -192,6 +192,10 @@ public:
// @cmember Setta lo stato di dirty del campo
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
void set_justify(bool 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
// fv 12/8/93
// relation class for isam files
@ -1773,7 +1773,11 @@ int TRecord_array::remove_from(int pos) const
TLocalisamfile f(_file);
rec->put(_num, pos);
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);
if (found >= pos)
{