summaryrefslogtreecommitdiffstats
path: root/src/bmserver
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2010-03-05 14:42:36 +0100
committerjasplin <qt-info@nokia.com>2010-03-05 14:42:36 +0100
commitc357204d22c20b1298a8e816e65751b6d85d2549 (patch)
tree356e965238a0a222d076a46e7fe31ca2d38157c1 /src/bmserver
parentc8bfd658fa5c80785f88bf647b450d2283ddf888 (diff)
Performance index support: Reintroduced multiple index trees + implemented more commands.
It turned out that we need to keep a time series of index trees for the performance index after all: There will be one base index tree (at timestamp -1, i.e. older than any result), and one index tree for the timestamps where the current index tree was changed (i.e. essentially one or more result histories and/or sub-indexes added or removed). The index is evaluated on the basis of the closest index tree earlier than the requested evaluation time. This ensures that the correct history constants are used. (The history constants in turn ensure continuity of the index values upon adding or removing result histories and/or sub-indexes). The following bmclient commands are implemented so far: - index set base - sets the index base from an XML file - index get tree - lists a certain index tree as XML - index get names - lists the available index names - index get values - evaluates an index at a set of timestamps; dumps the result to stdout - index get plot - same, except the result is plotted in an image - get result - verifies a result ID in the XML file
Diffstat (limited to 'src/bmserver')
-rw-r--r--src/bmserver/main.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/bmserver/main.cpp b/src/bmserver/main.cpp
index 2acabc7..842a5b3 100644
--- a/src/bmserver/main.cpp
+++ b/src/bmserver/main.cpp
@@ -119,10 +119,11 @@ static bool initDatabase(const QString &dbfile, QString *error)
// index_
ok = query.exec(
"CREATE TABLE index_(id INTEGER PRIMARY KEY AUTOINCREMENT"
- ", indexId INTEGER REFERENCES index_(id)"
+ ", parentId INTEGER REFERENCES index_(id)"
", resultId INTEGER REFERENCES result(id)"
", name TEXT"
- ", description TEXT"
+ ", description TEXT NOT NULL"
+ ", timestamp INTEGER NOT NULL"
", weight REAL NOT NULL"
", historyConstant REAL"
", UNIQUE(name));");
@@ -174,6 +175,9 @@ static bool initDatabase(const QString &dbfile, QString *error)
ok = query.exec("CREATE INDEX index_index_name ON index_(name);");
Q_ASSERT(ok);
+ ok = query.exec("CREATE INDEX index_index_timestamp ON index_(timestamp);");
+ Q_ASSERT(ok);
+
return true;
}