Stricter tokenization of datetime

This commit is contained in:
Dianne Skoll
2024-09-11 09:01:52 -04:00
parent 42f5e3467d
commit b054baf590
2 changed files with 9 additions and 1 deletions

View File

@@ -3061,6 +3061,7 @@ int DoCoerce(char type, Value *v)
case STR_TYPE:
s = v->v.str;
i=0; /* Avoid compiler warning */
if (ParseLiteralTime(&s, &i)) return E_CANT_COERCE;
if (*s) return E_CANT_COERCE;
v->type = TIME_TYPE;

View File

@@ -246,7 +246,14 @@ void FindNumericToken(char const *s, Token *t)
int dse, tim;
r = ParseLiteralDate(&p, &dse, &tim);
if (r == OK) {
if (*p) return;
if (*p) {
if (tim == NO_TIME) {
t->val = -E_BAD_DATE;
} else {
t->val = -E_BAD_TIME;
}
return;
}
if (tim == NO_TIME) {
t->type = T_Date;
t->val = dse;