[smartpl] handle intervals in 'week' as days due to lack of SQLite modifier support
This commit is contained in:
parent
3dcd826513
commit
62201e4128
|
@ -425,10 +425,27 @@ interval returns [ pANTLR3_STRING result ]
|
||||||
@init { $result = NULL; }
|
@init { $result = NULL; }
|
||||||
: INT DATINTERVAL
|
: INT DATINTERVAL
|
||||||
{
|
{
|
||||||
|
pANTLR3_UINT8 interval;
|
||||||
|
int intval;
|
||||||
|
char buf[25];
|
||||||
|
|
||||||
$result = $DATINTERVAL.text->factory->newRaw($DATINTERVAL.text->factory);
|
$result = $DATINTERVAL.text->factory->newRaw($DATINTERVAL.text->factory);
|
||||||
$result->append8($result, (const char *)$INT.text->chars);
|
|
||||||
$result->append8($result, " ");
|
// SQL doesnt have a modifer for 'week' but for day/hr/min/sec/month/yr
|
||||||
$result->append8($result, (const char *)$DATINTERVAL.text->chars);
|
interval = $DATINTERVAL.text->chars;
|
||||||
|
if (strcmp((char *)interval, "weeks") == 0)
|
||||||
|
{
|
||||||
|
intval = atoi((const char *)$INT.text->chars) * 7;
|
||||||
|
snprintf(buf, sizeof(buf), "\%d days", intval);
|
||||||
|
|
||||||
|
$result->append8($result, buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result->append8($result, (const char *)$INT.text->chars);
|
||||||
|
$result->append8($result, " ");
|
||||||
|
$result->append8($result, (const char *)$DATINTERVAL.text->chars);
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in New Issue