relation.cpp Modificata la generazione dei nomi degli indici dei cursori

relation.h     Migliorata spaziatura
scanner.cpp    Corretta apertura e chiusura dello stream
scanner.h      Corretto test di errore


git-svn-id: svn://10.65.10.50/trunk@6587 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1998-05-04 08:07:27 +00:00
parent 5ef993980d
commit cc4fd2a9da
4 changed files with 15 additions and 11 deletions

View File

@ -934,7 +934,11 @@ FILE* TCursor::open_index(
{
_last_created = create;
if (create || _indexname.empty())
_indexname.temp("ci");
{
TString16 radix;
radix.format("c%d_", file().num());
_indexname.temp(radix);
}
if (_indexname != _last_name)
{
@ -1090,7 +1094,7 @@ bool TCursor::changed()
_index_firm != prefix().get_codditta())
return TRUE;
if (_frozen && _lastrec > 0L)
if (_frozen && _lastrec > 0L)
return FALSE;
const int handle = file().handle();
@ -1223,7 +1227,7 @@ int TCursor::test(TIsamop op, TReclock lockop) const
int err = NOERR;
if (op == _isequal)
{
const TString80 match(curfile.curr().key(_nkey));
const TString match(curfile.curr().key(_nkey));
bool trovato = FALSE;
for (err = curfile.read(op, lockop);
@ -1634,7 +1638,7 @@ int TSorted_cursor::filtercursor(int pagecnt, TRecnotype* page)
{
int np=0 /*, handle=file().filehnd()->fhnd */;
TRectype& rec=file().curr();
TString s;
TString s, sf, fmt;
El_To_Sort Element;
for (int i=0; i< pagecnt; i++)
@ -1659,7 +1663,7 @@ int TSorted_cursor::filtercursor(int pagecnt, TRecnotype* page)
if (s.right(1) == "-" || s.right(1) == "+")
s.cut(s.len()-1);
TFieldref f(s,0);
TString sf=f.read(*relation());
sf=f.read(*relation());
TRectype& frec = file(f.file()).curr();
TFieldtypes fld_type = frec.type(f.name());
if (fld_type == _datefld) // Se il campo e' di tipo data, la converte in ANSI!
@ -1668,7 +1672,6 @@ int TSorted_cursor::filtercursor(int pagecnt, TRecnotype* page)
sf=d.string(ANSI);
}
if (is_up) sf.upper();
TString fmt;
if (fld_type == _alfafld || fld_type == _datefld)
fmt.format("%%-%ds",f.len(frec));
else

View File

@ -403,7 +403,7 @@ public:
{ return _filter.not_empty() || _filterfunction; }
// @cmember Salva la posizione attuale di tutti i file del cursore
void save_status ()
void save_status()
{ _if->save_status(); }
// @cmember Ripristina la posizione attuale di tutti i file del cursore
void restore_status ()

View File

@ -14,13 +14,14 @@ TScanner::TScanner(const char* filename)
{
setbuf(_buffer.get_buffer(), _buffer.size());
open(filename, ios::in | ios::nocreate, filebuf::sh_read);
if (bad())
fatal_box("Impossibile aprire %s", filename);
if (fail())
fatal_box("Impossibile leggere il file '%s'", filename);
}
TScanner::~TScanner()
{
close(); // Altrimenti si incasina col buffer!
close();
setbuf(NULL, 0); // Altrimenti si incasina col buffer!
}

View File

@ -19,7 +19,7 @@ class TScanner : public ifstream
{
// @access:(INTERNAL) Private Member
// @cmember:(INTERNAL) Prossimo teoken
// @cmember:(INTERNAL) Prossimo token
TString _token;
// @cmember:(INTERNAL) Chiave del token (prime due lettere)
TString _key;