aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sisudoc/ocda/abstraction/db_in.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/sisudoc/ocda/abstraction/db_in.d')
-rw-r--r--src/sisudoc/ocda/abstraction/db_in.d17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/sisudoc/ocda/abstraction/db_in.d b/src/sisudoc/ocda/abstraction/db_in.d
index 0da123d..3d10540 100644
--- a/src/sisudoc/ocda/abstraction/db_in.d
+++ b/src/sisudoc/ocda/abstraction/db_in.d
@@ -136,7 +136,7 @@ template spineAbstractionDbRead() {
return doc;
}
auto db = Database(db_file, SQLITE_OPEN_READONLY);
- /+ ↓ the three header blocks, from the metadata table. the key prefix
+ /+ ↓ the four header blocks, from the metadata table. the key prefix
says which block a row belongs to, and insertion order is kept +/
foreach (row; db.execute("SELECT key, value FROM metadata ORDER BY rowid")) {
string _k = row["key"].as!string;
@@ -150,16 +150,25 @@ template spineAbstractionDbRead() {
doc.doc_has[_kk] = _v;
doc.doc_has_order ~= _kk;
} else if (_k.startsWith("schema.")) {
- if (_k == "schema.version") { doc.format = "% SiSU Document Abstraction v0.1"; }
+ if (_k == "schema.version") {
+ doc.format = "% SiSU Document Abstraction v" ~ _v;
+ }
} else if (_k == "source.filename") {
doc.source = _v;
- } else if (_k == "source.language") {
- // carried in the path, not in the .ssp header
+ } else if (_k == "source.ssp_digest") {
+ /+ ↓ this database's own note of the .ssp it was built from. it is
+ not part of the .ssp, so it does not go back into the block +/
+ doc.ssp_digest = _v;
+ } else if (_k.startsWith("source.")) {
+ string _kk = _k["source.".length .. $];
+ doc.source_info[_kk] = _v;
+ doc.source_info_order ~= _kk;
} else {
doc.meta[_k] = _v;
doc.meta_order ~= _k;
}
}
+ if (!sspFormatVersionOk(doc.format, db_file)) { return SSPdocument(); }
/+ ↓ the objects, section by section, in the order they were written +/
string[] _sections;
foreach (row; db.execute(