isam.cpp Corretta buildkey coi booleani
maskfld.cpp relation.cpp Corretta gestione cursori vuoti git-svn-id: svn://10.65.10.50/trunk@2936 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5a47a0786d
commit
7ae31d9d8a
@ -225,7 +225,6 @@ HIDDEN int CBuildKey(RecDes *recd, int numkey, RecType recin, char *key, bool b
|
|||||||
if (numkey-- <= recd->NKeys)
|
if (numkey-- <= recd->NKeys)
|
||||||
{
|
{
|
||||||
int l = 0;
|
int l = 0;
|
||||||
bool wasbool = FALSE;
|
|
||||||
for (int i = 0; i < recd->Ky[numkey].NkFields; i++)
|
for (int i = 0; i < recd->Ky[numkey].NkFields; i++)
|
||||||
{
|
{
|
||||||
const KeyDes& kd = recd->Ky[numkey];
|
const KeyDes& kd = recd->Ky[numkey];
|
||||||
@ -251,9 +250,14 @@ HIDDEN int CBuildKey(RecDes *recd, int numkey, RecType recin, char *key, bool b
|
|||||||
return(_iskeylenerr);
|
return(_iskeylenerr);
|
||||||
}
|
}
|
||||||
if (f == _boolfld /* && build_x_cb */)
|
if (f == _boolfld /* && build_x_cb */)
|
||||||
key[l] = *(recin + off) > ' ' ? 'T' : 'F';
|
{
|
||||||
|
const bool on = *(recin + off) > ' ' && strchr("STXY", *(recin + off)) != NULL;
|
||||||
|
key[l] = on ? 'T' : 'F';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
strncpy((key + l), (recin + off), len);
|
strncpy((key + l), (recin + off), len);
|
||||||
|
}
|
||||||
|
|
||||||
if (recin[off] == '\0')
|
if (recin[off] == '\0')
|
||||||
{
|
{
|
||||||
@ -274,7 +278,6 @@ HIDDEN int CBuildKey(RecDes *recd, int numkey, RecType recin, char *key, bool b
|
|||||||
for (int i = l+len-1; i >= l; i--)
|
for (int i = l+len-1; i >= l; i--)
|
||||||
key[i] = toupper(key[i]);
|
key[i] = toupper(key[i]);
|
||||||
|
|
||||||
wasbool = f == _boolfld;
|
|
||||||
l += len;
|
l += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2872,22 +2875,28 @@ void TRectype::put(const char* fieldname, bool val)
|
|||||||
|
|
||||||
|
|
||||||
void TRectype::put(const char* fieldname, const char* val)
|
void TRectype::put(const char* fieldname, const char* val)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (val == NULL || *val == '\0') // Da provare
|
const TFieldtypes ft = (TFieldtypes)CFieldType((char*) fieldname, rec_des());
|
||||||
|
|
||||||
|
if (val == NULL) val = "";
|
||||||
|
|
||||||
|
if (ft == _boolfld)
|
||||||
|
val = (*val > ' ' && strchr("STXY", toupper(*val)) != NULL) ? "T" : "F";
|
||||||
|
|
||||||
|
if (*val == '\0') // Da provare
|
||||||
{
|
{
|
||||||
TRecfield f(*this, fieldname);
|
TRecfield f(*this, fieldname);
|
||||||
if (*f.pos() == '\0') return;
|
if (*f.pos() == '\0') return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CFieldType((char*) fieldname, rec_des()) == _datefld)
|
if (ft == _datefld)
|
||||||
{
|
{
|
||||||
TRecfield f(*this, fieldname);
|
TRecfield f(*this, fieldname);
|
||||||
f = val;
|
f = val;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(CFieldType((char*) fieldname, rec_des()) == _memofld)
|
if(ft == _memofld)
|
||||||
{
|
{
|
||||||
// Qui registro il campo memo
|
// Qui registro il campo memo
|
||||||
CHECK( _memoinfo, "La struttura TMemo_info non è stata allocata!" );
|
CHECK( _memoinfo, "La struttura TMemo_info non è stata allocata!" );
|
||||||
@ -2895,18 +2904,7 @@ void TRectype::put(const char* fieldname, const char* val)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TString wval;
|
if (CPutFieldBuff((char*) fieldname, rec_des(), (char*)val, _rec) == FIELDERR)
|
||||||
wval=val;
|
|
||||||
|
|
||||||
if (CFieldType((char*) fieldname,rec_des()) == _boolfld)
|
|
||||||
{
|
|
||||||
if (toupper(*val) == 'T' || toupper(*val) == 'Y'
|
|
||||||
|| toupper(*val) == 'S' || toupper(*val) == 'X')
|
|
||||||
wval="T";
|
|
||||||
else
|
|
||||||
wval="F";
|
|
||||||
}
|
|
||||||
if (CPutFieldBuff((char*) fieldname, rec_des(), (char*) (const char*)wval, _rec) == FIELDERR)
|
|
||||||
UNKNOWN_FIELD(num(), fieldname);
|
UNKNOWN_FIELD(num(), fieldname);
|
||||||
}
|
}
|
||||||
setempty(FALSE);
|
setempty(FALSE);
|
||||||
|
@ -2395,10 +2395,8 @@ const TBrowse* TEdit_field::parse_browse(TScanner& scanner) const
|
|||||||
const int id = scanner.integer();
|
const int id = scanner.integer();
|
||||||
const TEdit_field& f = mask().efield(id);
|
const TEdit_field& f = mask().efield(id);
|
||||||
const TBrowse* b = f.browse();
|
const TBrowse* b = f.browse();
|
||||||
#ifdef DBG
|
|
||||||
if (b == NULL)
|
if (b == NULL)
|
||||||
yesnofatal_box("La USE del campo %d e' nulla e non puo' essere copiata nel campo %d", id, dlg());
|
NFCHECK("La USE del campo %d e' nulla e non puo' essere copiata nel campo %d", id, dlg());
|
||||||
#endif
|
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2418,6 +2416,13 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
|||||||
if (scanner.key() == "FO") { _check = CHECK_REQUIRED; _forced = TRUE; } else
|
if (scanner.key() == "FO") { _check = CHECK_REQUIRED; _forced = TRUE; } else
|
||||||
if (scanner.key() == "SE") _check = CHECK_SEARCH;
|
if (scanner.key() == "SE") _check = CHECK_SEARCH;
|
||||||
else _check = CHECK_NONE;
|
else _check = CHECK_NONE;
|
||||||
|
if (sheet())
|
||||||
|
{
|
||||||
|
#ifdef DBG
|
||||||
|
NFCHECK("Checktype inutile sul campo %d", dlg());
|
||||||
|
#endif
|
||||||
|
_check = CHECK_NONE;
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2798,7 +2803,7 @@ bool TEdit_field::on_key(KEY key)
|
|||||||
handler(K_TAB);
|
handler(K_TAB);
|
||||||
break;
|
break;
|
||||||
case K_ENTER:
|
case K_ENTER:
|
||||||
if (field() != NULL || mask().mode() == NO_MODE)
|
// if (field() != NULL || mask().mode() == NO_MODE)
|
||||||
{
|
{
|
||||||
bool ok = validate(K_ENTER); // Check validation expression
|
bool ok = validate(K_ENTER); // Check validation expression
|
||||||
if (!ok)
|
if (!ok)
|
||||||
@ -2808,28 +2813,25 @@ bool TEdit_field::on_key(KEY key)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool query = mask().query_mode();
|
if (!mask().query_mode() || forced())
|
||||||
|
|
||||||
// check consistency
|
|
||||||
if (_browse)
|
|
||||||
{
|
{
|
||||||
if (sheet())
|
ok = !(check_type() == CHECK_REQUIRED && empty());
|
||||||
ok = query || sheet()->check(FINAL_CHECK);
|
// check consistency
|
||||||
else
|
if (ok && _browse)
|
||||||
{
|
{
|
||||||
ok = query || !(check_type() == CHECK_REQUIRED && empty());
|
if (sheet())
|
||||||
if (ok && check_enabled() && vf != 21 && // 21 = NOT_EMPTY_CHECK_FIELD
|
ok = sheet()->check(FINAL_CHECK);
|
||||||
(!query || forced()))
|
else
|
||||||
{
|
{
|
||||||
if (dirty()) ok = browse()->check(FINAL_CHECK); // Check consistency
|
if (ok && check_enabled() && vf != 21) // 21 = NOT_EMPTY_CHECK_FIELD
|
||||||
else ok = browse()->empty_check();
|
{
|
||||||
|
if (dirty()) ok = browse()->check(FINAL_CHECK); // Check consistency
|
||||||
|
else ok = browse()->empty_check();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!ok) return default_error_box();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
ok = !required() || get().not_empty();
|
|
||||||
if (!ok) return default_error_box();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case K_F9:
|
case K_F9:
|
||||||
|
@ -1164,8 +1164,16 @@ TRecnotype TCursor::read(TIsamop op, TReclock lockop, TDate& atdate)
|
|||||||
if (approx && _if->file().status() == _iseof)
|
if (approx && _if->file().status() == _iseof)
|
||||||
{
|
{
|
||||||
_pos = _totrec - 1;
|
_pos = _totrec - 1;
|
||||||
readrec();
|
if (_pos < 0)
|
||||||
file().setstatus(_iseof);
|
{
|
||||||
|
file().zero();
|
||||||
|
file().setstatus(_isemptyfile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
readrec();
|
||||||
|
file().setstatus(_iseof);
|
||||||
|
}
|
||||||
return _pos;
|
return _pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user