@@ -265,25 +265,39 @@ static const char DEBUGINFOD_SQLITE_DDL[] =
" foreign key (content) references " BUILDIDS "_files(id) on update cascade on delete cascade,\n"
" primary key (content, file, mtime)\n"
" ) " WITHOUT_ROWID ";\n"
+ "create table if not exists " BUILDIDS "_r_seekable (\n" // seekable rpm contents
+ " file integer not null,\n"
+ " content integer not null,\n"
+ " type text not null,\n"
+ " size integer not null,\n"
+ " offset integer not null,\n"
+ " mtime integer not null,\n"
+ " foreign key (file) references " BUILDIDS "_files(id) on update cascade on delete cascade,\n"
+ " foreign key (content) references " BUILDIDS "_files(id) on update cascade on delete cascade,\n"
+ " primary key (file, content)\n"
+ " ) " WITHOUT_ROWID ";\n"
// create views to glue together some of the above tables, for webapi D queries
- "create view if not exists " BUILDIDS "_query_d as \n"
+ // NB: _query_d2 and _query_e2 were added to replace _query_d and _query_e
+ // without updating BUILDIDS. They can be renamed back the next time BUILDIDS
+ // is updated.
+ "create view if not exists " BUILDIDS "_query_d2 as \n"
"select\n"
- " b.hex as buildid, n.mtime, 'F' as sourcetype, f0.name as source0, n.mtime as mtime, null as source1\n"
+ " b.hex as buildid, 'F' as sourcetype, n.file as id0, f0.name as source0, n.mtime as mtime, null as id1, null as source1\n"
" from " BUILDIDS "_buildids b, " BUILDIDS "_files_v f0, " BUILDIDS "_f_de n\n"
" where b.id = n.buildid and f0.id = n.file and n.debuginfo_p = 1\n"
"union all select\n"
- " b.hex as buildid, n.mtime, 'R' as sourcetype, f0.name as source0, n.mtime as mtime, f1.name as source1\n"
+ " b.hex as buildid, 'R' as sourcetype, n.file as id0, f0.name as source0, n.mtime as mtime, n.content as id1, f1.name as source1\n"
" from " BUILDIDS "_buildids b, " BUILDIDS "_files_v f0, " BUILDIDS "_files_v f1, " BUILDIDS "_r_de n\n"
" where b.id = n.buildid and f0.id = n.file and f1.id = n.content and n.debuginfo_p = 1\n"
";"
// ... and for E queries
- "create view if not exists " BUILDIDS "_query_e as \n"
+ "create view if not exists " BUILDIDS "_query_e2 as \n"
"select\n"
- " b.hex as buildid, n.mtime, 'F' as sourcetype, f0.name as source0, n.mtime as mtime, null as source1\n"
+ " b.hex as buildid, 'F' as sourcetype, n.file as id0, f0.name as source0, n.mtime as mtime, null as id1, null as source1\n"
" from " BUILDIDS "_buildids b, " BUILDIDS "_files_v f0, " BUILDIDS "_f_de n\n"
" where b.id = n.buildid and f0.id = n.file and n.executable_p = 1\n"
"union all select\n"
- " b.hex as buildid, n.mtime, 'R' as sourcetype, f0.name as source0, n.mtime as mtime, f1.name as source1\n"
+ " b.hex as buildid, 'R' as sourcetype, n.file as id0, f0.name as source0, n.mtime as mtime, n.content as id1, f1.name as source1\n"
" from " BUILDIDS "_buildids b, " BUILDIDS "_files_v f0, " BUILDIDS "_files_v f1, " BUILDIDS "_r_de n\n"
" where b.id = n.buildid and f0.id = n.file and f1.id = n.content and n.executable_p = 1\n"
";"
@@ -2557,7 +2571,7 @@ handle_buildid (MHD_Connection* conn,
if (atype_code == "D")
{
pp = new sqlite_ps (thisdb, "mhd-query-d",
- "select mtime, sourcetype, source0, source1 from " BUILDIDS "_query_d where buildid = ? "
+ "select mtime, sourcetype, source0, source1 from " BUILDIDS "_query_d2 where buildid = ? "
"order by mtime desc");
pp->reset();
pp->bind(1, buildid);
@@ -2565,7 +2579,7 @@ handle_buildid (MHD_Connection* conn,
else if (atype_code == "E")
{
pp = new sqlite_ps (thisdb, "mhd-query-e",
- "select mtime, sourcetype, source0, source1 from " BUILDIDS "_query_e where buildid = ? "
+ "select mtime, sourcetype, source0, source1 from " BUILDIDS "_query_e2 where buildid = ? "
"order by mtime desc");
pp->reset();
pp->bind(1, buildid);
@@ -2589,9 +2603,9 @@ handle_buildid (MHD_Connection* conn,
else if (atype_code == "I")
{
pp = new sqlite_ps (thisdb, "mhd-query-i",
- "select mtime, sourcetype, source0, source1, 1 as debug_p from " BUILDIDS "_query_d where buildid = ? "
+ "select mtime, sourcetype, source0, source1, 1 as debug_p from " BUILDIDS "_query_d2 where buildid = ? "
"union all "
- "select mtime, sourcetype, source0, source1, 0 as debug_p from " BUILDIDS "_query_e where buildid = ? "
+ "select mtime, sourcetype, source0, source1, 0 as debug_p from " BUILDIDS "_query_e2 where buildid = ? "
"order by debug_p desc, mtime desc");
pp->reset();
pp->bind(1, buildid);