Skip to content

Commit

Permalink
sqlite3gen: use the refid stored in the refids table
Browse files Browse the repository at this point in the history
All refid are now INTEGERS pointing into the refids Table.
  • Loading branch information
groleo committed Jul 25, 2016
1 parent 79a53cc commit 9b02db9
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions src/sqlite3gen.cpp
Expand Up @@ -60,7 +60,7 @@ const char * schema_queries[][2] = {
{ "innerclass",
"CREATE TABLE IF NOT EXISTS innerclass (\n"
"\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
"\trefid TEXT NOT NULL,\n"
"\trefid INTEGER NOT NULL,\n"
"\tprot INTEGER NOT NULL,\n"
"\tname TEXT NOT NULL\n"
");"
Expand Down Expand Up @@ -96,7 +96,7 @@ const char * schema_queries[][2] = {
"\tid_file INTEGER NOT NULL, -- file where this identifier is located\n"
"\tline INTEGER NOT NULL, -- line where this identifier is located\n"
"\tcolumn INTEGER NOT NULL, -- column where this identifier is located\n"
"\trefid TEXT NOT NULL, -- see the refids table\n"
"\trefid INTEGER NOT NULL, -- see the refids table\n"
"\tname TEXT NOT NULL,\n"
"\tdefinition TEXT,\n"
"\ttype TEXT,\n"
Expand Down Expand Up @@ -141,7 +141,7 @@ const char * schema_queries[][2] = {
"\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
"\tname TEXT NOT NULL,\n"
"\tkind TEXT NOT NULL,\n"
"\trefid TEXT NOT NULL,\n"
"\trefid INTEGER NOT NULL,\n"
"\tprot INTEGER NOT NULL,\n"
"\tid_file INTEGER NOT NULL,\n"
"\tline INTEGER NOT NULL,\n"
Expand All @@ -153,7 +153,7 @@ const char * schema_queries[][2] = {
"\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
"\tbase TEXT NOT NULL,\n"
"\tderived TEXT NOT NULL,\n"
"\trefid TEXT NOT NULL,\n"
"\trefid INTEGER NOT NULL,\n"
"\tprot INTEGER NOT NULL,\n"
"\tvirt INTEGER NOT NULL\n"
");"
Expand All @@ -163,7 +163,7 @@ const char * schema_queries[][2] = {
"\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
"\tbase TEXT NOT NULL,\n"
"\tderived TEXT NOT NULL,\n"
"\trefid TEXT NOT NULL,\n"
"\trefid INTEGER NOT NULL,\n"
"\tprot INTEGER NOT NULL,\n"
"\tvirt INTEGER NOT NULL\n"
");"
Expand Down Expand Up @@ -192,7 +192,7 @@ const char * schema_queries[][2] = {
{ "innernamespaces",
"CREATE TABLE IF NOT EXISTS innernamespaces (\n"
"\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
"\trefid TEXT NOT NULL,\n"
"\trefid INTEGER NOT NULL,\n"
"\tname TEXT NOT NULL\n"
");"
}
Expand Down Expand Up @@ -637,7 +637,8 @@ static void writeInnerClasses(sqlite3*db,const ClassSDict *cl)
{
if (!cd->isHidden() && cd->name().find('@')==-1) // skip anonymous scopes
{
bindTextParameter(innerclass_insert,":refid",cd->getOutputFileBase(),FALSE);
int refid = insertRefid(db, cd->getOutputFileBase());
bindIntParameter(innerclass_insert,":refid", refid);
bindIntParameter(innerclass_insert,":prot",cd->protection());
bindTextParameter(innerclass_insert,":name",cd->name());
step(db,innerclass_insert);
Expand All @@ -656,7 +657,8 @@ static void writeInnerNamespaces(sqlite3 *db,const NamespaceSDict *nl)
{
if (!nd->isHidden() && nd->name().find('@')==-1) // skip anonymouse scopes
{
bindTextParameter(innernamespace_insert,":refid",nd->getOutputFileBase(),FALSE);
int refid = insertRefid(db, nd->getOutputFileBase());
bindIntParameter(innernamespace_insert,":refid",refid);
bindTextParameter(innernamespace_insert,":name",nd->name(),FALSE);
step(db,innernamespace_insert);
}
Expand Down Expand Up @@ -740,9 +742,12 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def)
// group members are only visible in their group
//if (def->definitionType()!=Definition::TypeGroup && md->getGroupDef()) return;
QCString memType;

// memberdef
QCString refid = md->getOutputFileBase() + "_1" + md->anchor();
bindTextParameter(memberdef_insert,":refid", refid.data(),FALSE);
QCString qrefid = md->getOutputFileBase() + "_1" + md->anchor();
int refid = insertRefid(db, qrefid.data());

bindIntParameter(memberdef_insert,":refid", refid);
bindIntParameter(memberdef_insert,":kind",md->memberType());
bindIntParameter(memberdef_insert,":prot",md->protection());

Expand Down Expand Up @@ -1009,7 +1014,8 @@ static void generateSqlite3ForClass(sqlite3 *db, ClassDef *cd)
bindTextParameter(compounddef_insert,":name",cd->name());
bindTextParameter(compounddef_insert,":kind",cd->compoundTypeString(),FALSE);
bindIntParameter(compounddef_insert,":prot",cd->protection());
bindTextParameter(compounddef_insert,":refid",cd->getOutputFileBase(),FALSE);
int refid = insertRefid(db, cd->getOutputFileBase());
bindIntParameter(compounddef_insert,":refid", refid);

int id_file = insertFile(db,cd->getDefFileName().data());
bindIntParameter(compounddef_insert,":id_file",id_file);
Expand All @@ -1025,7 +1031,8 @@ static void generateSqlite3ForClass(sqlite3 *db, ClassDef *cd)
BaseClassDef *bcd;
for (bcli.toFirst();(bcd=bcli.current());++bcli)
{
bindTextParameter(basecompoundref_insert,":refid",bcd->classDef->getOutputFileBase(),FALSE);
int refid = insertRefid(db, bcd->classDef->getOutputFileBase());
bindIntParameter(basecompoundref_insert,":refid", refid);
bindIntParameter(basecompoundref_insert,":prot",bcd->prot);
bindIntParameter(basecompoundref_insert,":virt",bcd->virt);

Expand Down Expand Up @@ -1058,7 +1065,8 @@ static void generateSqlite3ForClass(sqlite3 *db, ClassDef *cd)
{
bindTextParameter(derivedcompoundref_insert,":derived",bcd->classDef->displayName(),FALSE);
}
bindTextParameter(derivedcompoundref_insert,":refid",bcd->classDef->getOutputFileBase(),FALSE);
int refid = insertRefid(db, bcd->classDef->getOutputFileBase());
bindIntParameter(derivedcompoundref_insert,":refid", refid);
bindIntParameter(derivedcompoundref_insert,":prot",bcd->prot);
bindIntParameter(derivedcompoundref_insert,":virt",bcd->virt);
step(db,derivedcompoundref_insert);
Expand Down

0 comments on commit 9b02db9

Please sign in to comment.