* Implemented missing date parsing; queries like "last_modified > %-5 minutes%"
are now working as they should. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31711 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -99,6 +99,7 @@ private:
|
|||||||
bool deleteOnError);
|
bool deleteOnError);
|
||||||
status_t _SetPredicate(const char* expression);
|
status_t _SetPredicate(const char* expression);
|
||||||
status_t _EvaluateStack();
|
status_t _EvaluateStack();
|
||||||
|
void _ParseDates(BString& parsedPredicate);
|
||||||
|
|
||||||
// FBC
|
// FBC
|
||||||
virtual void _QwertyQuery1();
|
virtual void _QwertyQuery1();
|
||||||
|
|||||||
@@ -518,8 +518,11 @@ BQuery::Fetch()
|
|||||||
if (!fPredicate || fDevice < 0)
|
if (!fPredicate || fDevice < 0)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
fQueryFd = _kern_open_query(fDevice, fPredicate, strlen(fPredicate),
|
BString parsedPredicate;
|
||||||
fLive ? B_LIVE_QUERY : 0, fPort, fToken);
|
_ParseDates(parsedPredicate);
|
||||||
|
|
||||||
|
fQueryFd = _kern_open_query(fDevice, parsedPredicate.String(),
|
||||||
|
parsedPredicate.Length(), fLive ? B_LIVE_QUERY : 0, fPort, fToken);
|
||||||
if (fQueryFd < 0)
|
if (fQueryFd < 0)
|
||||||
return fQueryFd;
|
return fQueryFd;
|
||||||
|
|
||||||
@@ -761,6 +764,41 @@ BQuery::_EvaluateStack()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BQuery::_ParseDates(BString& parsedPredicate)
|
||||||
|
{
|
||||||
|
const char* start = fPredicate;
|
||||||
|
const char* pos = start;
|
||||||
|
bool quotes = false;
|
||||||
|
|
||||||
|
while (pos[0]) {
|
||||||
|
if (pos[0] == '\\') {
|
||||||
|
pos++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (pos[0] == '"')
|
||||||
|
quotes = !quotes;
|
||||||
|
else if (!quotes && pos[0] == '%') {
|
||||||
|
const char* end = strchr(pos + 1, '%');
|
||||||
|
if (end == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
parsedPredicate.Append(start, pos - start);
|
||||||
|
start = end + 1;
|
||||||
|
|
||||||
|
// We have a date string
|
||||||
|
BString date(pos + 1, start - 1 - pos);
|
||||||
|
parsedPredicate << parsedate(date.String(), time(NULL));
|
||||||
|
|
||||||
|
pos = end;
|
||||||
|
}
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
|
||||||
|
parsedPredicate.Append(start, pos - start);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// FBC
|
// FBC
|
||||||
void BQuery::_QwertyQuery1() {}
|
void BQuery::_QwertyQuery1() {}
|
||||||
void BQuery::_QwertyQuery2() {}
|
void BQuery::_QwertyQuery2() {}
|
||||||
|
|||||||
Reference in New Issue
Block a user