Parametrizzata CBuildKey: ora le chiavi per codebase vengono costruite
con lo zero in caso di campo numerico vuoto. git-svn-id: svn://10.65.10.50/trunk@1557 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e47765d734
commit
ab0ac8ed3a
@ -165,12 +165,12 @@ HIDDEN void relisfd(isfdptr & isfd)
|
||||
delete isfd;
|
||||
}
|
||||
|
||||
HIDDEN int CBuildKey(RecDes *recd, int numkey, RecType recin, char *key)
|
||||
/* *recd; descrittore record */
|
||||
/* numkey; numero chiave */
|
||||
/* recin; buffer contenente il record */
|
||||
/* *key; valore della chiave */
|
||||
|
||||
HIDDEN int CBuildKey(RecDes *recd, int numkey, RecType recin, char *key, bool build_x_cb)
|
||||
/* *recd; descrittore record */
|
||||
/* numkey; numero chiave */
|
||||
/* recin; buffer contenente il record */
|
||||
/* *key; valore della chiave */
|
||||
/* build_x_cb flag di costruzione per codebase */
|
||||
{
|
||||
int i, nf, l = 0, len, off;
|
||||
/* TrDate wd ;
|
||||
@ -227,9 +227,9 @@ HIDDEN int CBuildKey(RecDes *recd, int numkey, RecType recin, char *key)
|
||||
#ifdef XVT_OS
|
||||
if (recin[off] == '\0') memset(key + l, ' ', len);
|
||||
else
|
||||
if ((recd->Fd[nf].TypeF == _intfld) ||
|
||||
(recd->Fd[nf].TypeF == _longfld) ||
|
||||
(recd->Fd[nf].TypeF == _wordfld))
|
||||
if (!build_x_cb && ((recd->Fd[nf].TypeF == _intfld) ||
|
||||
(recd->Fd[nf].TypeF == _longfld) ||
|
||||
(recd->Fd[nf].TypeF == _wordfld)))
|
||||
{
|
||||
int w = l, j = l + len;
|
||||
while (w < j && key[w] == ' ') w++;
|
||||
@ -290,7 +290,7 @@ HIDDEN int cisread(isfdptr isfd, TRectype & record, int mode)
|
||||
}
|
||||
if (rmode>=_isequal && rmode<=_isgteq)
|
||||
{
|
||||
err=CBuildKey(isfd->r,DB_tagget(isfd->fhnd),record.string(),key);
|
||||
err=CBuildKey(isfd->r,DB_tagget(isfd->fhnd),record.string(),key,TRUE);
|
||||
if (err == NOERR)
|
||||
{
|
||||
err=DB_seek(isfd->fhnd,key);
|
||||
@ -308,7 +308,7 @@ HIDDEN int cisread(isfdptr isfd, TRectype & record, int mode)
|
||||
}
|
||||
if (!tlock && err == _islocked)
|
||||
{
|
||||
CBuildKey(isfd->r, DB_tagget(isfd->fhnd), record.string(), key);
|
||||
CBuildKey(isfd->r, DB_tagget(isfd->fhnd), record.string(), key, TRUE);
|
||||
message_box("Codice %s in uso da parte\ndi un altro utente.", key);
|
||||
}
|
||||
} while (!tlock && err ==_islocked);
|
||||
@ -332,7 +332,7 @@ HIDDEN int delkeys(isfdptr fd, char* record,long recno)
|
||||
char key[128];
|
||||
|
||||
DB_tagselect(fd->fhnd,i);
|
||||
rt=CBuildKey(fd->r,i,record,key);
|
||||
rt=CBuildKey(fd->r,i,record,key,TRUE);
|
||||
if (rt!=NOERR) break;
|
||||
rt=DB_delkey(fd->fhnd,key,recno);
|
||||
if (rt!=NOERR) break;
|
||||
@ -670,7 +670,7 @@ int TBaseisamfile::skip(TRecnotype nrec, word lockop)
|
||||
do {
|
||||
if (!tlock && _lasterr == _islocked)
|
||||
{
|
||||
CBuildKey(_isamfile->r, DB_tagget(_isamfile->fhnd), curr().string(), key);
|
||||
CBuildKey(_isamfile->r, DB_tagget(_isamfile->fhnd), curr().string(), key,TRUE);
|
||||
message_box("Codice %s in uso da parte\ndi un altro utente.", key);
|
||||
}
|
||||
_lasterr=cisread(_isamfile,curr(),_iscurr + lockop);
|
||||
@ -2522,7 +2522,7 @@ TRectype& TRectype::operator =(const char* rec)
|
||||
const char* TRectype::key(int numkey) const
|
||||
{
|
||||
// NOT_LINKED(_i, "key");
|
||||
CBuildKey(rec_des(), numkey, _rec, _isam_string);
|
||||
CBuildKey(rec_des(), numkey, _rec, _isam_string,FALSE);
|
||||
return _isam_string;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user