Patch level : 10.0
Files correlati : ve3.exe Ricompilazione Demo : [ ] Commento : Aggiunta funzione YEAR al valutatore di espressioni Ora la get di un campo virtuale inesitente ritorna NULL invece che l'intero campo G1 git-svn-id: svn://10.65.10.50/trunk@19513 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4c02d14038
commit
de42d1e8c1
@ -853,10 +853,12 @@ void TAVM::execute(const TAVM_op& op)
|
||||
}
|
||||
break;
|
||||
case avm_dot:
|
||||
if (_outstr != NULL)
|
||||
*_outstr << _stack.pop().as_string();
|
||||
else
|
||||
xvtil_popup_message(_stack.pop().as_string());
|
||||
{
|
||||
const TString& msg = _stack.pop().as_string();
|
||||
if (_outstr != NULL)
|
||||
*_outstr << msg;
|
||||
// else xvtil_popup_message(msg); // More annoying than useful :-)
|
||||
}
|
||||
break;
|
||||
case avm_drop:
|
||||
if (!_stack.drop())
|
||||
@ -866,9 +868,7 @@ void TAVM::execute(const TAVM_op& op)
|
||||
}
|
||||
break;
|
||||
case avm_dup: _stack.push(_stack.peek()); break;
|
||||
case avm_else:
|
||||
_ip = op.var().as_int();
|
||||
break;
|
||||
case avm_else: _ip = op.var().as_int(); break;
|
||||
case avm_fetch: do_fetch(_stack.pop().as_string()); break;
|
||||
case avm_forget:
|
||||
{
|
||||
|
@ -820,6 +820,12 @@ void TExpression::eval()
|
||||
evalstack.push(good ? UNO : ZERO);
|
||||
}
|
||||
break;
|
||||
case _year:
|
||||
{
|
||||
const TDate d = evalstack.pop_string();
|
||||
evalstack.push(d.year());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
NFCHECK("operazione non valida %d", (int) instr.getsym());
|
||||
break;
|
||||
@ -839,14 +845,14 @@ HIDDEN char _tok[81];
|
||||
|
||||
TCodesym TExpression::tok2fun(const char* tok) const
|
||||
{
|
||||
const int MAX_TOK = 31;
|
||||
const int MAX_TOK = 32;
|
||||
HIDDEN const char* fnstr[MAX_TOK] = { "ANSI", "BETWEEN","CEIL", "CF_CHECK","COS",
|
||||
"EXP", "EXP10", "IF", "LEFT", "LEN",
|
||||
"LOG", "LOG10", "MAX", "MID", "MIN",
|
||||
"NUM", "PERC", "PI_CHECK","POW", "RIGHT",
|
||||
"ROUND", "SCORP", "SIN", "SQR", "SQRT",
|
||||
"STR", "SUBSTR", "TAN", "TRIM", "TRUNC",
|
||||
"UPPER" };
|
||||
"UPPER", "YEAR" };
|
||||
|
||||
HIDDEN TCodesym fntok[MAX_TOK] = { _ansi, _between, _ceil, _cfcheck, _cos,
|
||||
_exp, _exp10, _if, _left, _len,
|
||||
@ -854,7 +860,7 @@ TCodesym TExpression::tok2fun(const char* tok) const
|
||||
_num, _perc, _picheck, _pow, _right,
|
||||
_round, _scorp, _sin, _sqr, _sqrt,
|
||||
_str, _substr, _tan, _trim, _trunc,
|
||||
_upper };
|
||||
_upper, _year };
|
||||
|
||||
int f = 0, l = MAX_TOK-1, i = MAX_TOK/2;
|
||||
for (;;)
|
||||
@ -1168,6 +1174,7 @@ TCodesym TExpression::__factor(TCodesym startsym)
|
||||
case _upper:
|
||||
case _trim:
|
||||
case _len:
|
||||
case _year:
|
||||
sym = __function(1);
|
||||
_code.add(startsym);
|
||||
break;
|
||||
|
@ -71,7 +71,8 @@ enum TCodesym {
|
||||
_trim, // @emem Elimina spazi iniziali e finali di una stringa
|
||||
_between, // @emem controlla se il primo argomento e' compreso tra gli altri due
|
||||
_cfcheck, // @emem controlla il codice fiscale (+stato)
|
||||
_picheck // @emem controlla la partita IVA (+stato)
|
||||
_picheck, // @emem controlla la partita IVA (+stato)
|
||||
_year // @emem estrae l'anno da una data
|
||||
};
|
||||
// @doc INTERNAL
|
||||
|
||||
|
@ -1425,9 +1425,11 @@ const TVariant& TISAM_recordset::get_field(int logic, const char* fldname) const
|
||||
const int e = str.find('\n', s);
|
||||
var.set(str.sub(s, e));
|
||||
}
|
||||
else
|
||||
var.set_null();
|
||||
}
|
||||
|
||||
if (to >= from)
|
||||
if (to >= from && !var.is_empty())
|
||||
var.set(var.as_string().sub(from-1, to));
|
||||
|
||||
return var;
|
||||
|
Loading…
x
Reference in New Issue
Block a user