46 #define DBG_CTX(x) do { } while(0)
48 const char * schema_queries[][2] = {
50 "CREATE TABLE IF NOT EXISTS includes (\n"
51 "\t-- #include relations.\n"
52 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
53 "\tlocal INTEGER NOT NULL,\n"
54 "\tid_src INTEGER NOT NULL, -- File id of the includer.\n"
55 "\tid_dst INTEGER NOT NULL -- File id of the includee.\n"
57 "CREATE UNIQUE INDEX idx_includes ON includes\n"
58 "\t(local, id_src, id_dst);"
61 "CREATE TABLE IF NOT EXISTS innerclass (\n"
62 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
63 "\trefid INTEGER NOT NULL,\n"
64 "\tprot INTEGER NOT NULL,\n"
65 "\tname TEXT NOT NULL\n"
69 "CREATE TABLE IF NOT EXISTS files (\n"
70 "\t-- Names of source files and includes.\n"
71 "\tname TEXT PRIMARY KEY NOT NULL\n"
75 "CREATE TABLE IF NOT EXISTS refids (\n"
76 "\trefid TEXT PRIMARY KEY NOT NULL\n"
80 "CREATE TABLE IF NOT EXISTS xrefs (\n"
81 "\t-- Cross reference relation.\n"
82 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
83 "\trefid_src INTEGER NOT NULL, -- referrer id.\n"
84 "\trefid_dst INTEGER NOT NULL, -- referee id.\n"
85 "\tid_file INTEGER NOT NULL, -- file where the reference is happening.\n"
86 "\tline INTEGER NOT NULL, -- line where the reference is happening.\n"
87 "\tcolumn INTEGER NOT NULL -- column where the reference is happening.\n"
89 "CREATE UNIQUE INDEX idx_xrefs ON xrefs\n"
90 "\t(refid_src, refid_dst, id_file, line, column);"
93 "CREATE TABLE IF NOT EXISTS memberdef (\n"
94 "\t-- All processed identifiers.\n"
95 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
96 "\trefid INTEGER NOT NULL, -- see the refids table\n"
97 "\tname TEXT NOT NULL,\n"
98 "\tdefinition TEXT,\n"
100 "\targsstring TEXT,\n"
102 "\tinitializer TEXT,\n"
106 "\tprot INTEGER DEFAULT 0, -- 0:public 1:protected 2:private 3:package\n"
107 "\tstatic INTEGER DEFAULT 0, -- 0:no 1:yes\n"
108 "\tconst INTEGER DEFAULT 0, -- 0:no 1:yes\n"
109 "\texplicit INTEGER DEFAULT 0, -- 0:no 1:yes\n"
110 "\tinline INTEGER DEFAULT 0, -- 0:no 1:yes\n"
111 "\tfinal INTEGER DEFAULT 0, -- 0:no 1:yes\n"
112 "\tsealed INTEGER DEFAULT 0, -- 0:no 1:yes\n"
113 "\tnew INTEGER DEFAULT 0, -- 0:no 1:yes\n"
114 "\toptional INTEGER DEFAULT 0, -- 0:no 1:yes\n"
115 "\trequired INTEGER DEFAULT 0, -- 0:no 1:yes\n"
116 "\tvolatile INTEGER DEFAULT 0, -- 0:no 1:yes\n"
117 "\tvirt INTEGER DEFAULT 0, -- 0:no 1:virtual 2:pure-virtual\n"
118 "\tmutable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
119 "\tinitonly INTEGER DEFAULT 0, -- 0:no 1:yes\n"
120 "\tattribute INTEGER DEFAULT 0, -- 0:no 1:yes\n"
121 "\tproperty INTEGER DEFAULT 0, -- 0:no 1:yes\n"
122 "\treadonly INTEGER DEFAULT 0, -- 0:no 1:yes\n"
123 "\tbound INTEGER DEFAULT 0, -- 0:no 1:yes\n"
124 "\tconstrained INTEGER DEFAULT 0, -- 0:no 1:yes\n"
125 "\ttransient INTEGER DEFAULT 0, -- 0:no 1:yes\n"
126 "\tmaybevoid INTEGER DEFAULT 0, -- 0:no 1:yes\n"
127 "\tmaybedefault INTEGER DEFAULT 0, -- 0:no 1:yes\n"
128 "\tmaybeambiguous INTEGER DEFAULT 0, -- 0:no 1:yes\n"
129 "\treadable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
130 "\twritable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
131 "\tgettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
132 "\tprivategettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
133 "\tprotectedgettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
134 "\tsettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
135 "\tprivatesettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
136 "\tprotectedsettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
137 "\taccessor INTEGER DEFAULT 0, -- 0:no 1:assign 2:copy 3:retain 4:string 5:weak\n"
138 "\taddable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
139 "\tremovable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
140 "\traisable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
142 "\tkind INTEGER DEFAULT 0, -- 0:define 1:function 2:variable 3:typedef 4:enum 5:enumvalue 6:signal 7:slot 8:friend 9:DCOP 10:property 11:event\n"
143 "\tbodystart INTEGER DEFAULT 0, -- starting line of definition\n"
144 "\tbodyend INTEGER DEFAULT 0, -- ending line of definition\n"
145 "\tid_bodyfile INTEGER DEFAULT 0, -- file of definition\n"
146 "\tid_file INTEGER NOT NULL, -- file where this identifier is located\n"
147 "\tline INTEGER NOT NULL, -- line where this identifier is located\n"
148 "\tcolumn INTEGER NOT NULL, -- column where this identifier is located\n"
150 "\tdetaileddescription TEXT,\n"
151 "\tbriefdescription TEXT,\n"
152 "\tinbodydescription TEXT\n"
156 "CREATE TABLE IF NOT EXISTS compounddef (\n"
157 "\t-- class/struct definitions.\n"
158 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
159 "\tname TEXT NOT NULL,\n"
160 "\tkind TEXT NOT NULL,\n"
161 "\trefid INTEGER NOT NULL,\n"
162 "\tprot INTEGER NOT NULL,\n"
163 "\tid_file INTEGER NOT NULL,\n"
164 "\tline INTEGER NOT NULL,\n"
165 "\tcolumn INTEGER NOT NULL\n"
169 "CREATE TABLE IF NOT EXISTS basecompoundref (\n"
170 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
171 "\tbase TEXT NOT NULL,\n"
172 "\tderived TEXT NOT NULL,\n"
173 "\trefid INTEGER NOT NULL,\n"
174 "\tprot INTEGER NOT NULL,\n"
175 "\tvirt INTEGER NOT NULL\n"
178 {
"derivedcompoundref",
179 "CREATE TABLE IF NOT EXISTS derivedcompoundref (\n"
180 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
181 "\tbase TEXT NOT NULL,\n"
182 "\tderived TEXT NOT NULL,\n"
183 "\trefid INTEGER NOT NULL,\n"
184 "\tprot INTEGER NOT NULL,\n"
185 "\tvirt INTEGER NOT NULL\n"
189 "CREATE TABLE IF NOT EXISTS params (\n"
190 "\t-- All processed parameters.\n"
191 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
192 "\tattributes TEXT,\n"
198 "\tbriefdescription TEXT\n"
201 {
"memberdef_params",
202 "CREATE TABLE IF NOT EXISTS memberdef_params (\n"
203 "\t-- Junction table for memberdef parameters.\n"
204 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
205 "\tid_memberdef INTEGER NOT NULL,\n"
206 "\tid_param INTEGER NOT NULL\n"
210 "CREATE TABLE IF NOT EXISTS innernamespaces (\n"
211 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
212 "\trefid INTEGER NOT NULL,\n"
213 "\tname TEXT NOT NULL\n"
224 SqlStmt incl_insert = {
"INSERT INTO includes "
225 "( local, id_src, id_dst ) "
227 "(:local,:id_src,:id_dst )"
230 SqlStmt incl_select = {
"SELECT COUNT(*) FROM includes WHERE "
231 "local=:local AND id_src=:id_src AND id_dst=:id_dst"
235 SqlStmt innerclass_insert={
"INSERT INTO innerclass "
236 "( refid, prot, name )"
238 "(:refid,:prot,:name )"
242 SqlStmt files_select = {
"SELECT rowid FROM files WHERE name=:name"
245 SqlStmt files_insert = {
"INSERT INTO files "
252 SqlStmt refids_select = {
"SELECT rowid FROM refids WHERE "
256 SqlStmt refids_insert = {
"INSERT INTO refids "
263 SqlStmt xrefs_insert= {
"INSERT INTO xrefs "
264 "( refid_src, refid_dst, id_file, line, column )"
266 "(:refid_src,:refid_dst,:id_file,:line,:column )"
270 SqlStmt memberdef_insert={
"INSERT INTO memberdef "
324 "detaileddescription,"
367 ":protectedgettable,"
382 ":detaileddescription,"
389 SqlStmt compounddef_insert={
"INSERT INTO compounddef "
390 "( name, kind, prot, refid, id_file, line, column ) "
392 "(:name,:kind,:prot,:refid,:id_file,:line,:column )"
396 SqlStmt basecompoundref_insert={
"INSERT INTO basecompoundref "
397 "( base, derived, refid, prot, virt ) "
399 "(:base,:derived,:refid,:prot,:virt )"
403 SqlStmt derivedcompoundref_insert={
"INSERT INTO derivedcompoundref "
404 "( refid, prot, virt, base, derived ) "
406 "(:refid,:prot,:virt,:base,:derived )"
410 SqlStmt params_select = {
"SELECT rowid FROM params WHERE "
411 "(attributes IS NULL OR attributes=:attributes) AND "
412 "(type IS NULL OR type=:type) AND "
413 "(declname IS NULL OR declname=:declname) AND "
414 "(defname IS NULL OR defname=:defname) AND "
415 "(array IS NULL OR array=:array) AND "
416 "(defval IS NULL OR defval=:defval) AND "
417 "(briefdescription IS NULL OR briefdescription=:briefdescription)"
420 SqlStmt params_insert = {
"INSERT INTO params "
421 "( attributes, type, declname, defname, array, defval, briefdescription ) "
423 "(:attributes,:type,:declname,:defname,:array,:defval,:briefdescription)"
427 SqlStmt memberdef_params_insert={
"INSERT INTO memberdef_params "
428 "( id_memberdef, id_param)"
430 "(:id_memberdef,:id_param)"
434 SqlStmt innernamespace_insert={
"INSERT INTO innernamespaces "
445 TextGeneratorSqlite3Impl(
StringList &l) : l(l) {
446 l.setAutoDelete(TRUE);
453 DBG_CTX((
"writeBreak\n"));
455 void writeLink(
const char * ,
const char *file,
456 const char *anchor,
const char *
459 QCString *rs=
new QCString(file);
462 rs->append(
"_1").append(anchor);
472 static void bindTextParameter(SqlStmt &s,
const char *name,
const char *value,
bool _static=TRUE)
474 int idx = sqlite3_bind_parameter_index(s.stmt, name);
475 sqlite3_bind_text(s.stmt, idx, value, -1, _static==TRUE?SQLITE_STATIC:SQLITE_TRANSIENT);
478 static void bindIntParameter(SqlStmt &s,
const char *name,
int value)
480 int idx = sqlite3_bind_parameter_index(s.stmt, name);
481 sqlite3_bind_int(s.stmt, idx, value);
484 static int step(sqlite3 *db, SqlStmt &s,
bool getRowId=FALSE,
bool select=FALSE)
487 int rc = sqlite3_step(s.stmt);
488 if (rc!=SQLITE_DONE && rc!=SQLITE_ROW)
490 msg(
"sqlite3_step failed: %s\n", sqlite3_errmsg(db));
491 sqlite3_clear_bindings(s.stmt);
494 if (getRowId && select) rowid = sqlite3_column_int(s.stmt, 0);
495 if (getRowId && !select) rowid = sqlite3_last_insert_rowid(db);
496 sqlite3_reset(s.stmt);
497 sqlite3_clear_bindings(s.stmt);
501 static int insertFile(sqlite3 *db,
const char* name)
504 if (name==0)
return rowid;
506 bindTextParameter(files_select,
":name",name);
507 rowid=step(db,files_select,TRUE,TRUE);
510 bindTextParameter(files_insert,
":name",name);
511 rowid=step(db,files_insert,TRUE);
516 static int insertRefid(sqlite3 *db,
const char *refid)
519 if (refid==0)
return rowid;
521 bindTextParameter(refids_select,
":refid",refid);
522 rowid=step(db,refids_select,TRUE,TRUE);
525 bindTextParameter(refids_insert,
":refid",refid);
526 rowid=step(db,refids_insert,TRUE);
532 static void insertMemberReference(sqlite3 *db,
int refid_src,
int refid_dst,
533 int id_file,
int line,
int column)
535 if (id_file==-1||refid_src==-1||refid_dst==-1)
538 bindIntParameter(xrefs_insert,
":refid_src",refid_src);
539 bindIntParameter(xrefs_insert,
":refid_dst",refid_dst);
540 bindIntParameter(xrefs_insert,
":id_file",id_file);
541 bindIntParameter(xrefs_insert,
":line",line);
542 bindIntParameter(xrefs_insert,
":column",column);
543 step(db,xrefs_insert);
552 int refid_src = insertRefid(db,qrefid_src.data());
553 int refid_dst = insertRefid(db,qrefid_dst.data());
554 int id_file = insertFile(db,
"no-file");
555 insertMemberReference(db,refid_src,refid_dst,id_file,dst->
getStartBodyLine(),-1);
559 static void insertMemberFunctionParams(sqlite3 *db,
int id_memberdef,
MemberDef *md,
Definition *def)
563 if (declAl!=0 && declAl->count()>0)
568 for (declAli.toFirst();(a=declAli.current());++declAli)
570 Argument *defArg = defAli.current();
574 bindTextParameter(params_select,
":attributes",a->
attrib.data());
575 bindTextParameter(params_insert,
":attributes",a->
attrib.data());
577 if (!a->
type.isEmpty())
584 while ((s=li.current()))
587 int refid_src = insertRefid(db,qrefid_src.data());
588 int refid_dst = insertRefid(db,s->data());
590 insertMemberReference(db,refid_src,refid_dst,id_file,md->
getDefLine(),-1);
593 bindTextParameter(params_select,
":type",a->
type.data());
594 bindTextParameter(params_insert,
":type",a->
type.data());
596 if (!a->
name.isEmpty())
598 bindTextParameter(params_select,
":declname",a->
name.data());
599 bindTextParameter(params_insert,
":declname",a->
name.data());
601 if (defArg && !defArg->
name.isEmpty() && defArg->
name!=a->
name)
603 bindTextParameter(params_select,
":defname",defArg->
name.data());
604 bindTextParameter(params_insert,
":defname",defArg->
name.data());
606 if (!a->
array.isEmpty())
608 bindTextParameter(params_select,
":array",a->
array.data());
609 bindTextParameter(params_insert,
":array",a->
array.data());
615 bindTextParameter(params_select,
":defval",a->
defval.data());
616 bindTextParameter(params_insert,
":defval",a->
defval.data());
618 if (defArg) ++defAli;
620 int id_param=step(db,params_select,TRUE,TRUE);
622 id_param=step(db,params_insert,TRUE);
625 bindIntParameter(memberdef_params_insert,
":id_memberdef",id_memberdef);
626 bindIntParameter(memberdef_params_insert,
":id_param",id_param);
627 step(db,memberdef_params_insert);
632 static void insertMemberDefineParams(sqlite3 *db,
int id_memberdef,
MemberDef *md,
Definition *def)
637 DBG_CTX((
"no params\n"));
643 for (ali.toFirst();(a=ali.current());++ali)
645 bindTextParameter(params_insert,
":defname",a->type.data());
646 int id_param=step(db,params_insert,TRUE);
648 bindIntParameter(memberdef_params_insert,
":id_memberdef",id_memberdef);
649 bindIntParameter(memberdef_params_insert,
":id_param",id_param);
650 step(db,memberdef_params_insert);
661 if (typeStr.stripPrefix(
"static "));
662 else if (typeStr.stripPrefix(
"virtual "));
663 else if (typeStr.stripPrefix(
"volatile "));
664 else if (typeStr==
"virtual") typeStr=
"";
669 static int prepareStatement(sqlite3 *db, SqlStmt &s)
672 rc = sqlite3_prepare_v2(db,s.query,-1,&s.stmt,0);
675 msg(
"prepare failed for %s\n%s\n", s.query, sqlite3_errmsg(db));
681 static int prepareStatements(sqlite3 *db)
684 -1==prepareStatement(db, memberdef_insert) ||
685 -1==prepareStatement(db, files_insert) ||
686 -1==prepareStatement(db, files_select) ||
687 -1==prepareStatement(db, refids_insert) ||
688 -1==prepareStatement(db, refids_select) ||
689 -1==prepareStatement(db, incl_insert)||
690 -1==prepareStatement(db, incl_select)||
691 -1==prepareStatement(db, params_insert) ||
692 -1==prepareStatement(db, params_select) ||
693 -1==prepareStatement(db, xrefs_insert) ||
694 -1==prepareStatement(db, innerclass_insert) ||
695 -1==prepareStatement(db, compounddef_insert) ||
696 -1==prepareStatement(db, basecompoundref_insert) ||
697 -1==prepareStatement(db, derivedcompoundref_insert) ||
698 -1==prepareStatement(db, memberdef_params_insert)||
699 -1==prepareStatement(db, innernamespace_insert)
707 static void beginTransaction(sqlite3 *db)
710 sqlite3_exec(db,
"BEGIN TRANSACTION", NULL, NULL, &sErrMsg);
713 static void endTransaction(sqlite3 *db)
716 sqlite3_exec(db,
"END TRANSACTION", NULL, NULL, &sErrMsg);
719 static void pragmaTuning(sqlite3 *db)
722 sqlite3_exec(db,
"PRAGMA synchronous = OFF", NULL, NULL, &sErrMsg);
723 sqlite3_exec(db,
"PRAGMA journal_mode = MEMORY", NULL, NULL, &sErrMsg);
724 sqlite3_exec(db,
"PRAGMA temp_store = MEMORY;", NULL, NULL, &sErrMsg);
727 static int initializeSchema(sqlite3* db)
730 sqlite3_stmt *stmt = 0;
732 msg(
"Initializing DB schema...\n");
733 for (
unsigned int k = 0; k <
sizeof(schema_queries) /
sizeof(schema_queries[0]); k++)
735 const char *q = schema_queries[k][1];
737 rc = sqlite3_prepare_v2(db, q, -1, &stmt, 0);
740 msg(
"failed to prepare query: %s\n\t%s\n", q, sqlite3_errmsg(db));
743 rc = sqlite3_step(stmt);
744 if (rc != SQLITE_DONE)
746 msg(
"failed to execute query: %s\n\t%s\n", q, sqlite3_errmsg(db));
749 sqlite3_finalize(stmt);
761 for (cli.toFirst();(cd=cli.current());++cli)
766 bindIntParameter(innerclass_insert,
":refid", refid);
767 bindIntParameter(innerclass_insert,
":prot",cd->
protection());
768 bindTextParameter(innerclass_insert,
":name",cd->
name());
769 step(db,innerclass_insert);
781 for (nli.toFirst();(nd=nli.current());++nli)
786 bindIntParameter(innernamespace_insert,
":refid",refid);
787 bindTextParameter(innernamespace_insert,
":name",nd->
name(),FALSE);
788 step(db,innernamespace_insert);
804 for (ali.toFirst();(a=ali.current());++ali)
806 if (!a->
type.isEmpty())
808 #warning linkifyText(TextGeneratorXMLImpl(t),scope,fileScope,0,a->type);
809 bindTextParameter(params_select,
":type",a->
type);
810 bindTextParameter(params_insert,
":type",a->
type);
812 if (!a->
name.isEmpty())
814 bindTextParameter(params_select,
":declname",a->
name);
815 bindTextParameter(params_insert,
":declname",a->
name);
816 bindTextParameter(params_select,
":defname",a->
name);
817 bindTextParameter(params_insert,
":defname",a->
name);
821 #warning linkifyText(TextGeneratorXMLImpl(t),scope,fileScope,0,a->defval);
822 bindTextParameter(params_select,
":defval",a->
defval);
823 bindTextParameter(params_insert,
":defval",a->
defval);
825 if (!step(db,params_select,TRUE,TRUE))
826 step(db,params_insert);
873 int refid = insertRefid(db, qrefid.data());
875 bindIntParameter(memberdef_insert,
":refid", refid);
876 bindIntParameter(memberdef_insert,
":kind",md->
memberType());
877 bindIntParameter(memberdef_insert,
":prot",md->
protection());
879 bindIntParameter(memberdef_insert,
":static",md->
isStatic());
903 bindIntParameter(memberdef_insert,
":explicit",md->
isExplicit());
904 bindIntParameter(memberdef_insert,
":inline",md->
isInline());
905 bindIntParameter(memberdef_insert,
":final",md->
isFinal());
906 bindIntParameter(memberdef_insert,
":sealed",md->
isSealed());
907 bindIntParameter(memberdef_insert,
":new",md->
isNew());
908 bindIntParameter(memberdef_insert,
":optional",md->
isOptional());
909 bindIntParameter(memberdef_insert,
":required",md->
isRequired());
911 bindIntParameter(memberdef_insert,
":virt",md->
virtualness());
916 bindIntParameter(memberdef_insert,
":mutable",md->
isMutable());
917 bindIntParameter(memberdef_insert,
":initonly",md->
isInitonly());
918 bindIntParameter(memberdef_insert,
":attribute",md->
isAttribute());
919 bindIntParameter(memberdef_insert,
":property",md->
isProperty());
920 bindIntParameter(memberdef_insert,
":readonly",md->
isReadonly());
921 bindIntParameter(memberdef_insert,
":bound",md->
isBound());
922 bindIntParameter(memberdef_insert,
":removable",md->
isRemovable());
923 bindIntParameter(memberdef_insert,
":constrained",md->
isConstrained());
924 bindIntParameter(memberdef_insert,
":transient",md->
isTransient());
925 bindIntParameter(memberdef_insert,
":maybevoid",md->
isMaybeVoid());
926 bindIntParameter(memberdef_insert,
":maybedefault",md->
isMaybeDefault());
927 bindIntParameter(memberdef_insert,
":maybeambiguous",md->
isMaybeAmbiguous());
931 if (bitfield.at(0)==
':') bitfield=bitfield.mid(1);
932 bindTextParameter(memberdef_insert,
":bitfield",bitfield.stripWhiteSpace());
937 bindIntParameter(memberdef_insert,
":readable",md->
isReadable());
938 bindIntParameter(memberdef_insert,
":writable",md->
isWritable());
939 bindIntParameter(memberdef_insert,
":gettable",md->
isGettable());
942 bindIntParameter(memberdef_insert,
":settable",md->
isSettable());
950 else if (md->
isCopy()) accessor = 2;
951 else if (md->
isRetain()) accessor = 3;
952 else if (md->
isStrong()) accessor = 4;
953 else if (md->
isWeak()) accessor = 5;
955 bindIntParameter(memberdef_insert,
":accessor",accessor);
962 bindIntParameter(memberdef_insert,
":addable",md->
isAddable());
963 bindIntParameter(memberdef_insert,
":removable",md->
isRemovable());
964 bindIntParameter(memberdef_insert,
":raisable",md->
isRaisable());
982 bindTextParameter(memberdef_insert,
":type",typeStr.data(),FALSE);
987 bindTextParameter(memberdef_insert,
":definition",md->
definition());
992 bindTextParameter(memberdef_insert,
":argsstring",md->
argsString());
996 bindTextParameter(memberdef_insert,
":name",md->
name());
1001 bindTextParameter(memberdef_insert,
":initializer",md->
initializer().data());
1007 while ((s=li.current()))
1011 DBG_CTX((
"initializer:%s %s %s %d\n",
1017 int refid_src = insertRefid(db,qrefid_src.data());
1018 int refid_dst = insertRefid(db,s->data());
1020 insertMemberReference(db,refid_src,refid_dst,id_file,md->
getStartBodyLine(),-1);
1028 bindTextParameter(memberdef_insert,
":scope",md->
getScopeString().data(),FALSE);
1032 bindTextParameter(memberdef_insert,
":briefdescription",md->
briefDescription(),FALSE);
1033 bindTextParameter(memberdef_insert,
":detaileddescription",md->
documentation(),FALSE);
1042 bindIntParameter(memberdef_insert,
":id_file",id_file);
1043 bindIntParameter(memberdef_insert,
":line",md->
getDefLine());
1044 bindIntParameter(memberdef_insert,
":column",md->
getDefColumn());
1049 if (id_bodyfile == -1)
1051 sqlite3_clear_bindings(memberdef_insert.stmt);
1055 bindIntParameter(memberdef_insert,
":id_bodyfile",id_bodyfile);
1057 bindIntParameter(memberdef_insert,
":bodyend",md->
getEndBodyLine());
1063 int id_memberdef=step(db,memberdef_insert,TRUE);
1067 insertMemberFunctionParams(db,id_memberdef,md,def);
1072 insertMemberDefineParams(db,id_memberdef,md,def);
1083 for (mdi.toFirst();(rmd=mdi.current());++mdi)
1085 insertMemberReference(db,md,rmd);
1094 for (mdi.toFirst();(rmd=mdi.current());++mdi)
1096 insertMemberReference(db,rmd,md);
1101 static void generateSqlite3Section(sqlite3*db,
1103 MemberList *ml,
const char * ,
const char * =0,
1110 for (mli.toFirst();(md=mli.current());++mli)
1119 if (count==0)
return;
1120 for (mli.toFirst();(md=mli.current());++mli)
1126 generateSqlite3ForMember(db,md,d);
1132 static void generateSqlite3ForClass(sqlite3 *db,
ClassDef *cd)
1152 if (cd->
name().find(
'@')!=-1)
return;
1155 msg(
"Generating Sqlite3 output for class %s\n",cd->
name().data());
1157 bindTextParameter(compounddef_insert,
":name",cd->
name());
1159 bindIntParameter(compounddef_insert,
":prot",cd->
protection());
1161 bindIntParameter(compounddef_insert,
":refid", refid);
1164 bindIntParameter(compounddef_insert,
":id_file",id_file);
1165 bindIntParameter(compounddef_insert,
":line",cd->
getDefLine());
1166 bindIntParameter(compounddef_insert,
":column",cd->
getDefColumn());
1168 step(db,compounddef_insert);
1175 for (bcli.toFirst();(bcd=bcli.current());++bcli)
1177 int refid = insertRefid(db, bcd->classDef->getOutputFileBase());
1178 bindIntParameter(basecompoundref_insert,
":refid", refid);
1179 bindIntParameter(basecompoundref_insert,
":prot",bcd->prot);
1180 bindIntParameter(basecompoundref_insert,
":virt",bcd->virt);
1182 if (!bcd->templSpecifiers.isEmpty())
1188 bindTextParameter(basecompoundref_insert,
":base",bcd->classDef->displayName(),FALSE);
1190 bindTextParameter(basecompoundref_insert,
":derived",cd->
displayName(),FALSE);
1191 step(db,basecompoundref_insert);
1200 for (bcli.toFirst();(bcd=bcli.current());++bcli)
1202 bindTextParameter(derivedcompoundref_insert,
":base",cd->
displayName(),FALSE);
1203 if (!bcd->templSpecifiers.isEmpty())
1209 bindTextParameter(derivedcompoundref_insert,
":derived",bcd->classDef->displayName(),FALSE);
1211 int refid = insertRefid(db, bcd->classDef->getOutputFileBase());
1212 bindIntParameter(derivedcompoundref_insert,
":refid", refid);
1213 bindIntParameter(derivedcompoundref_insert,
":prot",bcd->prot);
1214 bindIntParameter(derivedcompoundref_insert,
":virt",bcd->virt);
1215 step(db,derivedcompoundref_insert);
1227 int id_dst=insertFile(db,nm);
1229 bindIntParameter(incl_select,
":local",ii->
local);
1230 bindIntParameter(incl_select,
":id_src",id_file);
1231 bindIntParameter(incl_select,
":id_dst",id_dst);
1232 int count=step(db,incl_select,TRUE,TRUE);
1235 bindIntParameter(incl_insert,
":local",ii->
local);
1236 bindIntParameter(incl_insert,
":id_src",id_file);
1237 bindIntParameter(incl_insert,
":id_dst",id_dst);
1238 step(db,incl_insert);
1254 for (;(mg=mgli.current());++mgli)
1256 generateSqlite3Section(db,cd,mg->members(),
"user-defined",mg->header(),
1264 for (mli.toFirst();(ml=mli.current());++mli)
1268 generateSqlite3Section(db,cd,ml,
"user-defined");
1273 static void generateSqlite3ForNamespace(sqlite3 *db,
NamespaceDef *nd)
1297 for (;(mg=mgli.current());++mgli)
1299 generateSqlite3Section(db,nd,mg->members(),
"user-defined",mg->header(),
1307 for (mli.toFirst();(ml=mli.current());++mli)
1311 generateSqlite3Section(db,nd,ml,
"user-defined");
1316 static void generateSqlite3ForFile(sqlite3 *db,
FileDef *fd)
1339 for (ili.toFirst();(ii=ili.current());++ili)
1341 int id_src=insertFile(db,fd->
absFilePath().data());
1343 bindIntParameter(incl_select,
":local",ii->
local);
1344 bindIntParameter(incl_select,
":id_src",id_src);
1345 bindIntParameter(incl_select,
":id_dst",id_dst);
1346 if (step(db,incl_select,TRUE,TRUE)==0) {
1347 bindIntParameter(incl_insert,
":local",ii->
local);
1348 bindIntParameter(incl_insert,
":id_src",id_src);
1349 bindIntParameter(incl_insert,
":id_dst",id_dst);
1350 step(db,incl_insert);
1359 for (ili.toFirst();(ii=ili.current());++ili)
1363 bindIntParameter(incl_select,
":local",ii->
local);
1364 bindIntParameter(incl_select,
":id_src",id_src);
1365 bindIntParameter(incl_select,
":id_dst",id_dst);
1366 if (step(db,incl_select,TRUE,TRUE)==0) {
1367 bindIntParameter(incl_insert,
":local",ii->
local);
1368 bindIntParameter(incl_insert,
":id_src",id_src);
1369 bindIntParameter(incl_insert,
":id_dst",id_dst);
1370 step(db,incl_insert);
1392 for (;(mg=mgli.current());++mgli)
1394 generateSqlite3Section(db,fd,mg->members(),
"user-defined",mg->header(),
1402 for (mli.toFirst();(ml=mli.current());++mli)
1406 generateSqlite3Section(db,fd,ml,
"user-defined");
1411 static void generateSqlite3ForGroup(sqlite3*db,
GroupDef *gd)
1413 #warning WorkInProgress
1416 static void generateSqlite3ForDir(sqlite3 *db,
DirDef *dd)
1418 #warning WorkInProgress
1421 static void generateSqlite3ForPage(sqlite3 *db,
PageDef *pd,
bool isExample)
1423 #warning WorkInProgress
1438 QDir sqlite3Dir(outputDirectory);
1440 sqlite3_initialize();
1441 int rc = sqlite3_open_v2(outputDirectory+
"/doxygen_sqlite3.db", &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);
1442 if (rc != SQLITE_OK)
1445 msg(
"database open failed: %s\n",
"doxygen_sqlite3.db");
1448 beginTransaction(db);
1451 if (-1==initializeSchema(db))
1454 if ( -1 == prepareStatements(db) )
1456 err(
"sqlite generator: prepareStatements failed!");
1463 for (cli.toFirst();(cd=cli.current());++cli)
1465 msg(
"Generating Sqlite3 output for class %s\n",cd->
name().data());
1466 generateSqlite3ForClass(db,cd);
1472 for (nli.toFirst();(nd=nli.current());++nli)
1474 msg(
"Generating Sqlite3 output for namespace %s\n",nd->
name().data());
1475 generateSqlite3ForNamespace(db,nd);
1481 for (;(fn=fnli.current());++fnli)
1485 for (;(fd=fni.current());++fni)
1487 msg(
"Generating Sqlite3 output for file %s\n",fd->
name().data());
1488 generateSqlite3ForFile(db,fd);
1495 for (;(gd=gli.current());++gli)
1497 msg(
"Generating Sqlite3 output for group %s\n",gd->
name().data());
1498 generateSqlite3ForGroup(db,gd);
1505 for (pdi.toFirst();(pd=pdi.current());++pdi)
1507 msg(
"Generating Sqlite3 output for page %s\n",pd->
name().data());
1508 generateSqlite3ForPage(db,pd,FALSE);
1516 for (sdi.toFirst();(dir=sdi.current());++sdi)
1518 msg(
"Generating Sqlite3 output for dir %s\n",dir->
name().data());
1519 generateSqlite3ForDir(db,dir);
1527 for (pdi.toFirst();(pd=pdi.current());++pdi)
1529 msg(
"Generating Sqlite3 output for example %s\n",pd->
name().data());
1530 generateSqlite3ForPage(db,pd,TRUE);
1537 msg(
"Generating Sqlite3 output for the main page\n");
1544 #else // USE_SQLITE3
1547 err(
"sqlite3 support has not been compiled in!");