63 # define DBG_CTX(x) printf x
64 # else // SQLITE3_DEBUG
65 # define DBG_CTX(x) do { } while(0)
68 # ifdef SQLITE3_DEBUG_SQL
70 static void sqlLog(
void *dbName,
const char *sql){
71 msg(
"SQL: '%s'\n", sql);
75 const char * table_schema[][2] = {
78 "CREATE TABLE IF NOT EXISTS meta (\n"
79 "\t-- Information about this db and how it was generated.\n"
81 "\tdoxygen_version TEXT PRIMARY KEY NOT NULL,\n"
89 "\tschema_version TEXT NOT NULL, -- Schema-specific semver\n"
91 "\tgenerated_at TEXT NOT NULL,\n"
92 "\tgenerated_on TEXT NOT NULL,\n"
94 "\tproject_name TEXT NOT NULL,\n"
95 "\tproject_number TEXT,\n"
96 "\tproject_brief TEXT\n"
100 "CREATE TABLE IF NOT EXISTS includes (\n"
101 "\t-- #include relations.\n"
102 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
103 "\tlocal INTEGER NOT NULL,\n"
104 "\tsrc_id INTEGER NOT NULL REFERENCES path, -- File id of the includer.\n"
105 "\tdst_id INTEGER NOT NULL REFERENCES path, -- File id of the includee.\n"
110 "\tUNIQUE(local, src_id, dst_id) ON CONFLICT IGNORE\n"
114 "CREATE TABLE IF NOT EXISTS contains (\n"
115 "\t-- inner/outer relations (file, namespace, dir, class, group, page)\n"
116 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
117 "\tinner_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
118 "\touter_rowid INTEGER NOT NULL REFERENCES compounddef\n"
135 "CREATE TABLE IF NOT EXISTS path (\n"
136 "\t-- Paths of source files and includes.\n"
137 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
138 "\ttype INTEGER NOT NULL, -- 1:file 2:dir\n"
139 "\tlocal INTEGER NOT NULL,\n"
140 "\tfound INTEGER NOT NULL,\n"
141 "\tname TEXT NOT NULL\n"
145 "CREATE TABLE IF NOT EXISTS refid (\n"
146 "\t-- Distinct refid for all documented entities.\n"
147 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
148 "\trefid TEXT NOT NULL UNIQUE\n"
152 "CREATE TABLE IF NOT EXISTS xrefs (\n"
153 "\t-- Cross-reference relation\n"
154 "\t-- (combines xml <referencedby> and <references> nodes).\n"
155 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
156 "\tsrc_rowid INTEGER NOT NULL REFERENCES refid, -- referrer id.\n"
157 "\tdst_rowid INTEGER NOT NULL REFERENCES refid, -- referee id.\n"
158 "\tcontext TEXT NOT NULL, -- inline, argument, initializer\n"
159 "\t-- Just need to know they link; ignore duplicates.\n"
160 "\tUNIQUE(src_rowid, dst_rowid, context) ON CONFLICT IGNORE\n"
164 "CREATE TABLE IF NOT EXISTS memberdef (\n"
165 "\t-- All processed identifiers.\n"
166 "\trowid INTEGER PRIMARY KEY NOT NULL,\n"
167 "\tname TEXT NOT NULL,\n"
168 "\tdefinition TEXT,\n"
170 "\targsstring TEXT,\n"
172 "\tinitializer TEXT,\n"
176 "\tprot INTEGER DEFAULT 0, -- 0:public 1:protected 2:private 3:package\n"
177 "\tstatic INTEGER DEFAULT 0, -- 0:no 1:yes\n"
178 "\textern INTEGER DEFAULT 0, -- 0:no 1:yes\n"
179 "\tconst INTEGER DEFAULT 0, -- 0:no 1:yes\n"
180 "\texplicit INTEGER DEFAULT 0, -- 0:no 1:yes\n"
181 "\tinline INTEGER DEFAULT 0, -- 0:no 1:yes 2:both (set after encountering inline and not-inline)\n"
182 "\tfinal INTEGER DEFAULT 0, -- 0:no 1:yes\n"
183 "\tsealed INTEGER DEFAULT 0, -- 0:no 1:yes\n"
184 "\tnew INTEGER DEFAULT 0, -- 0:no 1:yes\n"
185 "\toptional INTEGER DEFAULT 0, -- 0:no 1:yes\n"
186 "\trequired INTEGER DEFAULT 0, -- 0:no 1:yes\n"
187 "\tvolatile INTEGER DEFAULT 0, -- 0:no 1:yes\n"
188 "\tvirt INTEGER DEFAULT 0, -- 0:no 1:virtual 2:pure-virtual\n"
189 "\tmutable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
190 "\tinitonly INTEGER DEFAULT 0, -- 0:no 1:yes\n"
191 "\tattribute INTEGER DEFAULT 0, -- 0:no 1:yes\n"
192 "\tproperty INTEGER DEFAULT 0, -- 0:no 1:yes\n"
193 "\treadonly INTEGER DEFAULT 0, -- 0:no 1:yes\n"
194 "\tbound INTEGER DEFAULT 0, -- 0:no 1:yes\n"
195 "\tconstrained INTEGER DEFAULT 0, -- 0:no 1:yes\n"
196 "\ttransient INTEGER DEFAULT 0, -- 0:no 1:yes\n"
197 "\tmaybevoid INTEGER DEFAULT 0, -- 0:no 1:yes\n"
198 "\tmaybedefault INTEGER DEFAULT 0, -- 0:no 1:yes\n"
199 "\tmaybeambiguous INTEGER DEFAULT 0, -- 0:no 1:yes\n"
200 "\treadable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
201 "\twritable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
202 "\tgettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
203 "\tprivategettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
204 "\tprotectedgettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
205 "\tsettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
206 "\tprivatesettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
207 "\tprotectedsettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
208 "\taccessor INTEGER DEFAULT 0, -- 0:no 1:assign 2:copy 3:retain 4:string 5:weak\n"
209 "\taddable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
210 "\tremovable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
211 "\traisable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
212 "\tkind TEXT NOT NULL, -- 'macro definition' 'function' 'variable' 'typedef' 'enumeration' 'enumvalue' 'signal' 'slot' 'friend' 'dcop' 'property' 'event' 'interface' 'service'\n"
213 "\tbodystart INTEGER DEFAULT 0, -- starting line of definition\n"
214 "\tbodyend INTEGER DEFAULT 0, -- ending line of definition\n"
215 "\tbodyfile_id INTEGER REFERENCES path, -- file of definition\n"
216 "\tfile_id INTEGER NOT NULL REFERENCES path, -- file where this identifier is located\n"
217 "\tline INTEGER NOT NULL, -- line where this identifier is located\n"
218 "\tcolumn INTEGER NOT NULL, -- column where this identifier is located\n"
219 "\tdetaileddescription TEXT,\n"
220 "\tbriefdescription TEXT,\n"
221 "\tinbodydescription TEXT,\n"
222 "\tFOREIGN KEY (rowid) REFERENCES refid (rowid)\n"
226 "CREATE TABLE IF NOT EXISTS member (\n"
227 "\t-- Memberdef <-> containing compound relation.\n"
228 "\t-- Similar to XML listofallmembers.\n"
229 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
230 "\tscope_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
231 "\tmemberdef_rowid INTEGER NOT NULL REFERENCES memberdef,\n"
232 "\tprot INTEGER NOT NULL,\n"
233 "\tvirt INTEGER NOT NULL,\n"
234 "\tUNIQUE(scope_rowid, memberdef_rowid)\n"
238 "CREATE TABLE IF NOT EXISTS reimplements (\n"
239 "\t-- Inherited member reimplementation relations.\n"
240 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
241 "\tmemberdef_rowid INTEGER NOT NULL REFERENCES memberdef, -- reimplementing memberdef id.\n"
242 "\treimplemented_rowid INTEGER NOT NULL REFERENCES memberdef, -- reimplemented memberdef id.\n"
243 "\tUNIQUE(memberdef_rowid, reimplemented_rowid) ON CONFLICT IGNORE\n"
247 "CREATE TABLE IF NOT EXISTS compounddef (\n"
248 "\t-- Class/struct definitions.\n"
249 "\trowid INTEGER PRIMARY KEY NOT NULL,\n"
250 "\tname TEXT NOT NULL,\n"
253 "\tkind TEXT NOT NULL, -- 'category' 'class' 'constants' 'dir' 'enum' 'example' 'exception' 'file' 'group' 'interface' 'library' 'module' 'namespace' 'package' 'page' 'protocol' 'service' 'singleton' 'struct' 'type' 'union' 'unknown' ''\n"
255 "\tfile_id INTEGER NOT NULL REFERENCES path,\n"
256 "\tline INTEGER NOT NULL,\n"
257 "\tcolumn INTEGER NOT NULL,\n"
258 "\theader_id INTEGER REFERENCES path,\n"
259 "\tdetaileddescription TEXT,\n"
260 "\tbriefdescription TEXT,\n"
261 "\tFOREIGN KEY (rowid) REFERENCES refid (rowid)\n"
265 "CREATE TABLE IF NOT EXISTS compoundref (\n"
266 "\t-- Inheritance relation.\n"
267 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
268 "\tbase_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
269 "\tderived_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
270 "\tprot INTEGER NOT NULL,\n"
271 "\tvirt INTEGER NOT NULL,\n"
272 "\tUNIQUE(base_rowid, derived_rowid)\n"
276 "CREATE TABLE IF NOT EXISTS param (\n"
277 "\t-- All processed parameters.\n"
278 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
279 "\tattributes TEXT,\n"
285 "\tbriefdescription TEXT\n"
287 "CREATE UNIQUE INDEX idx_param ON param\n"
291 "CREATE TABLE IF NOT EXISTS memberdef_param (\n"
292 "\t-- Junction table for memberdef parameters.\n"
293 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
294 "\tmemberdef_id INTEGER NOT NULL REFERENCES memberdef,\n"
295 "\tparam_id INTEGER NOT NULL REFERENCES param\n"
299 const char * view_schema[][2] = {
322 "CREATE VIEW IF NOT EXISTS def (\n"
323 "\t-- Combined summary of all -def types for easier joins.\n"
333 "\tmemberdef.kind,\n"
334 "\tmemberdef.name,\n"
335 "\tmemberdef.briefdescription \n"
337 "JOIN memberdef ON refid.rowid=memberdef.rowid \n"
342 "\tcompounddef.kind,\n"
343 "\tcompounddef.name,\n"
345 "\t\tWHEN briefdescription IS NOT NULL \n"
346 "\t\tTHEN briefdescription \n"
350 "JOIN compounddef ON refid.rowid=compounddef.rowid;"
354 "CREATE VIEW IF NOT EXISTS local_file (\n"
355 "\t-- File paths found within the project.\n"
364 "FROM path WHERE path.type=1 AND path.local=1 AND path.found=1;\n"
368 "CREATE VIEW IF NOT EXISTS external_file (\n"
369 "\t-- File paths outside the project (found or not).\n"
378 "FROM path WHERE path.type=1 AND path.local=0;\n"
382 "CREATE VIEW IF NOT EXISTS inline_xrefs (\n"
383 "\t-- Crossrefs from inline member source.\n"
390 "\txrefs.src_rowid,\n"
391 "\txrefs.dst_rowid\n"
392 "FROM xrefs WHERE xrefs.context='inline';\n"
396 "CREATE VIEW IF NOT EXISTS argument_xrefs (\n"
397 "\t-- Crossrefs from member def/decl arguments\n"
404 "\txrefs.src_rowid,\n"
405 "\txrefs.dst_rowid\n"
406 "FROM xrefs WHERE xrefs.context='argument';\n"
410 "CREATE VIEW IF NOT EXISTS initializer_xrefs (\n"
411 "\t-- Crossrefs from member initializers\n"
418 "\txrefs.src_rowid,\n"
419 "\txrefs.dst_rowid\n"
420 "FROM xrefs WHERE xrefs.context='initializer';\n"
424 "CREATE VIEW IF NOT EXISTS inner_outer\n"
425 "\t-- Joins 'contains' relations to simplify inner/outer 'rel' queries.\n"
429 "FROM def as inner\n"
430 "\tJOIN contains ON inner.rowid=contains.inner_rowid\n"
431 "\tJOIN def AS outer ON outer.rowid=contains.outer_rowid;\n"
435 "CREATE VIEW IF NOT EXISTS rel (\n"
436 "\t-- Boolean indicator of relations available for a given entity.\n"
437 "\t-- Join to (compound-|member-)def to find fetch-worthy relations.\n"
441 "\tinnercompounds,\n"
442 "\toutercompounds,\n"
451 "\tinnernamespaces,\n"
452 "\touternamespaces,\n"
461 "\targument_links_in,\n"
462 "\targument_links_out,\n"
463 "\tinitializer_links_in,\n"
464 "\tinitializer_links_out\n"
468 "\tEXISTS (SELECT rowid FROM reimplements WHERE reimplemented_rowid=def.rowid),\n"
469 "\tEXISTS (SELECT rowid FROM reimplements WHERE memberdef_rowid=def.rowid),\n"
470 "\t-- rowid/kind for inner, [rowid:1/kind:1] for outer\n"
471 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid),\n"
472 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid),\n"
473 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='page'),\n"
474 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='page'),\n"
475 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='dir'),\n"
476 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='dir'),\n"
477 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='file'),\n"
478 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='file'),\n"
479 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind in (\n"
480 "'category','class','enum','exception','interface','module','protocol',\n"
481 "'service','singleton','struct','type','union'\n"
483 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1] in (\n"
484 "'category','class','enum','exception','interface','module','protocol',\n"
485 "'service','singleton','struct','type','union'\n"
487 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='namespace'),\n"
488 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='namespace'),\n"
489 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='group'),\n"
490 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='group'),\n"
491 "\tEXISTS (SELECT rowid FROM member WHERE scope_rowid=def.rowid),\n"
492 "\tEXISTS (SELECT rowid FROM member WHERE memberdef_rowid=def.rowid),\n"
493 "\tEXISTS (SELECT rowid FROM compoundref WHERE base_rowid=def.rowid),\n"
494 "\tEXISTS (SELECT rowid FROM compoundref WHERE derived_rowid=def.rowid),\n"
495 "\tEXISTS (SELECT rowid FROM inline_xrefs WHERE dst_rowid=def.rowid),\n"
496 "\tEXISTS (SELECT rowid FROM inline_xrefs WHERE src_rowid=def.rowid),\n"
497 "\tEXISTS (SELECT rowid FROM argument_xrefs WHERE dst_rowid=def.rowid),\n"
498 "\tEXISTS (SELECT rowid FROM argument_xrefs WHERE src_rowid=def.rowid),\n"
499 "\tEXISTS (SELECT rowid FROM initializer_xrefs WHERE dst_rowid=def.rowid),\n"
500 "\tEXISTS (SELECT rowid FROM initializer_xrefs WHERE src_rowid=def.rowid)\n"
501 "FROM def ORDER BY def.rowid;"
507 const char *query = 0;
508 sqlite3_stmt *stmt = 0;
516 SqlStmt meta_insert = {
518 "( doxygen_version, schema_version, generated_at, generated_on, project_name, project_number, project_brief )"
520 "(:doxygen_version,:schema_version,:generated_at,:generated_on,:project_name,:project_number,:project_brief )"
524 SqlStmt incl_insert = {
525 "INSERT INTO includes "
526 "( local, src_id, dst_id ) "
528 "(:local,:src_id,:dst_id )"
531 SqlStmt incl_select = {
532 "SELECT COUNT(*) FROM includes WHERE "
533 "local=:local AND src_id=:src_id AND dst_id=:dst_id"
537 SqlStmt contains_insert={
538 "INSERT INTO contains "
539 "( inner_rowid, outer_rowid )"
541 "(:inner_rowid,:outer_rowid )"
545 SqlStmt path_select = {
546 "SELECT rowid FROM path WHERE name=:name"
549 SqlStmt path_insert = {
551 "( type, local, found, name )"
553 "(:type,:local,:found,:name )"
557 SqlStmt refid_select = {
558 "SELECT rowid FROM refid WHERE refid=:refid"
561 SqlStmt refid_insert = {
569 SqlStmt xrefs_insert= {
571 "( src_rowid, dst_rowid, context )"
573 "(:src_rowid,:dst_rowid,:context )"
576 SqlStmt reimplements_insert= {
577 "INSERT INTO reimplements "
578 "( memberdef_rowid, reimplemented_rowid )"
580 "(:memberdef_rowid,:reimplemented_rowid )"
584 SqlStmt memberdef_exists={
585 "SELECT EXISTS (SELECT * FROM memberdef WHERE rowid = :rowid)"
589 SqlStmt memberdef_incomplete={
591 "SELECT * FROM memberdef WHERE "
592 "rowid = :rowid AND inline != 2 AND inline != :new_inline"
597 SqlStmt memberdef_insert={
598 "INSERT INTO memberdef "
653 "detaileddescription,"
696 ":protectedsettable,"
697 ":protectedgettable,"
712 ":detaileddescription,"
725 SqlStmt memberdef_update_decl={
726 "UPDATE memberdef SET "
728 "file_id = :file_id,"
731 "detaileddescription = 'Declaration: ' || :detaileddescription || 'Definition: ' || detaileddescription,"
732 "briefdescription = 'Declaration: ' || :briefdescription || 'Definition: ' || briefdescription,"
733 "inbodydescription = 'Declaration: ' || :inbodydescription || 'Definition: ' || inbodydescription "
734 "WHERE rowid = :rowid"
737 SqlStmt memberdef_update_def={
738 "UPDATE memberdef SET "
740 "bodystart = :bodystart,"
741 "bodyend = :bodyend,"
742 "bodyfile_id = :bodyfile_id,"
743 "detaileddescription = 'Declaration: ' || detaileddescription || 'Definition: ' || :detaileddescription,"
744 "briefdescription = 'Declaration: ' || briefdescription || 'Definition: ' || :briefdescription,"
745 "inbodydescription = 'Declaration: ' || inbodydescription || 'Definition: ' || :inbodydescription "
746 "WHERE rowid = :rowid"
750 SqlStmt member_insert={
751 "INSERT INTO member "
752 "( scope_rowid, memberdef_rowid, prot, virt ) "
754 "(:scope_rowid,:memberdef_rowid,:prot,:virt )"
758 SqlStmt compounddef_insert={
759 "INSERT INTO compounddef "
771 "detaileddescription"
785 ":detaileddescription"
789 SqlStmt compounddef_exists={
791 "SELECT * FROM compounddef WHERE rowid = :rowid"
796 SqlStmt compoundref_insert={
797 "INSERT INTO compoundref "
798 "( base_rowid, derived_rowid, prot, virt ) "
800 "(:base_rowid,:derived_rowid,:prot,:virt )"
804 SqlStmt param_select = {
805 "SELECT rowid FROM param WHERE "
806 "(attributes IS NULL OR attributes=:attributes) AND "
807 "(type IS NULL OR type=:type) AND "
808 "(declname IS NULL OR declname=:declname) AND "
809 "(defname IS NULL OR defname=:defname) AND "
810 "(array IS NULL OR array=:array) AND "
811 "(defval IS NULL OR defval=:defval) AND "
812 "(briefdescription IS NULL OR briefdescription=:briefdescription)"
815 SqlStmt param_insert = {
817 "( attributes, type, declname, defname, array, defval, briefdescription ) "
819 "(:attributes,:type,:declname,:defname,:array,:defval,:briefdescription)"
823 SqlStmt memberdef_param_insert={
824 "INSERT INTO memberdef_param "
825 "( memberdef_id, param_id)"
827 "(:memberdef_id,:param_id)"
834 TextGeneratorSqlite3Impl(
StringVector &l) : m_list(l) { }
840 DBG_CTX((
"writeBreak\n"));
846 std::string rs = file.
str();
852 m_list.push_back(rs);
860 static bool bindTextParameter(SqlStmt &s,
const char *name,
const QCString &value,
bool _static=
FALSE)
862 int idx = sqlite3_bind_parameter_index(s.stmt, name);
864 err(
"sqlite3_bind_parameter_index(%s)[%s] failed: %s\n", name, s.query, sqlite3_errmsg(s.db));
867 int rv = sqlite3_bind_text(s.stmt, idx, value.
data(), -1, _static==
TRUE?SQLITE_STATIC:SQLITE_TRANSIENT);
869 err(
"sqlite3_bind_text(%s)[%s] failed: %s\n", name, s.query, sqlite3_errmsg(s.db));
875 static bool bindIntParameter(SqlStmt &s,
const char *name,
int value)
877 int idx = sqlite3_bind_parameter_index(s.stmt, name);
879 err(
"sqlite3_bind_parameter_index(%s)[%s] failed to find column: %s\n", name, s.query, sqlite3_errmsg(s.db));
882 int rv = sqlite3_bind_int(s.stmt, idx, value);
884 err(
"sqlite3_bind_int(%s)[%s] failed: %s\n", name, s.query, sqlite3_errmsg(s.db));
890 static int step(SqlStmt &s,
bool getRowId=
FALSE,
bool select=
FALSE)
893 int rc = sqlite3_step(s.stmt);
894 if (rc!=SQLITE_DONE && rc!=SQLITE_ROW)
896 DBG_CTX((
"sqlite3_step: %s (rc: %d)\n", sqlite3_errmsg(s.db), rc));
897 sqlite3_reset(s.stmt);
898 sqlite3_clear_bindings(s.stmt);
901 if (getRowId && select) rowid = sqlite3_column_int(s.stmt, 0);
902 if (getRowId && !select) rowid = sqlite3_last_insert_rowid(s.db);
903 sqlite3_reset(s.stmt);
904 sqlite3_clear_bindings(s.stmt);
908 static int insertPath(
QCString name,
bool local=
TRUE,
bool found=
TRUE,
int type=1)
911 if (name==0)
return rowid;
915 bindTextParameter(path_select,
":name",name.
data());
919 bindTextParameter(path_insert,
":name",name.
data());
920 bindIntParameter(path_insert,
":type",type);
921 bindIntParameter(path_insert,
":local",local?1:0);
922 bindIntParameter(path_insert,
":found",found?1:0);
923 rowid=step(path_insert,
TRUE);
928 static void recordMetadata()
930 bindTextParameter(meta_insert,
":doxygen_version",getFullVersion());
931 bindTextParameter(meta_insert,
":schema_version",
"0.2.1",
TRUE);
934 bindTextParameter(meta_insert,
":project_name",
Config_getString(PROJECT_NAME));
935 bindTextParameter(meta_insert,
":project_number",
Config_getString(PROJECT_NUMBER));
936 bindTextParameter(meta_insert,
":project_brief",
Config_getString(PROJECT_BRIEF));
946 struct Refid insertRefid(const
QCString &refid)
952 if (refid.isEmpty())
return ret;
954 bindTextParameter(refid_select,
":refid",refid);
955 ret.rowid=step(refid_select,
TRUE,
TRUE);
958 bindTextParameter(refid_insert,
":refid",refid);
959 ret.rowid=step(refid_insert,
TRUE);
966 static bool memberdefExists(
struct Refid refid)
968 bindIntParameter(memberdef_exists,
":rowid",refid.rowid);
969 int test = step(memberdef_exists,
TRUE,
TRUE);
970 return test ? true :
false;
973 static bool memberdefIncomplete(
struct Refid refid,
const MemberDef* md)
975 bindIntParameter(memberdef_incomplete,
":rowid",refid.rowid);
976 bindIntParameter(memberdef_incomplete,
":new_inline",md->
isInline());
977 int test = step(memberdef_incomplete,
TRUE,
TRUE);
978 return test ? true :
false;
981 static bool compounddefExists(
struct Refid refid)
983 bindIntParameter(compounddef_exists,
":rowid",refid.rowid);
984 int test = step(compounddef_exists,
TRUE,
TRUE);
985 return test ? true :
false;
988 static bool insertMemberReference(
struct Refid src_refid,
struct Refid dst_refid,
const char *context)
990 if (src_refid.rowid==-1||dst_refid.rowid==-1)
994 !bindIntParameter(xrefs_insert,
":src_rowid",src_refid.rowid) ||
995 !bindIntParameter(xrefs_insert,
":dst_rowid",dst_refid.rowid)
1002 bindTextParameter(xrefs_insert,
":context",context);
1009 static void insertMemberReference(
const MemberDef *src,
const MemberDef *dst,
const char *context)
1014 struct Refid src_refid = insertRefid(qsrc_refid);
1015 struct Refid dst_refid = insertRefid(qdst_refid);
1016 insertMemberReference(src_refid,dst_refid,context);
1019 static void insertMemberFunctionParams(
int memberdef_id,
const MemberDef *md,
const Definition *def)
1023 if (declAl.
size()>0)
1025 auto defIt = defAl.
begin();
1030 if (defIt!=defAl.
end())
1036 if (!a.attrib.isEmpty())
1038 bindTextParameter(param_select,
":attributes",a.attrib);
1039 bindTextParameter(param_insert,
":attributes",a.attrib);
1041 if (!a.type.isEmpty())
1046 for (
const auto &s : list)
1049 struct Refid src_refid = insertRefid(qsrc_refid);
1050 struct Refid dst_refid = insertRefid(s.c_str());
1051 insertMemberReference(src_refid,dst_refid,
"argument");
1053 bindTextParameter(param_select,
":type",a.type);
1054 bindTextParameter(param_insert,
":type",a.type);
1056 if (!a.name.isEmpty())
1058 bindTextParameter(param_select,
":declname",a.name);
1059 bindTextParameter(param_insert,
":declname",a.name);
1063 bindTextParameter(param_select,
":defname",defArg->
name);
1064 bindTextParameter(param_insert,
":defname",defArg->
name);
1066 if (!a.array.isEmpty())
1068 bindTextParameter(param_select,
":array",a.array);
1069 bindTextParameter(param_insert,
":array",a.array);
1071 if (!a.defval.isEmpty())
1075 bindTextParameter(param_select,
":defval",a.defval);
1076 bindTextParameter(param_insert,
":defval",a.defval);
1079 int param_id=step(param_select,
TRUE,
TRUE);
1081 param_id=step(param_insert,
TRUE);
1084 DBG_CTX((
"error INSERT params failed\n"));
1088 bindIntParameter(memberdef_param_insert,
":memberdef_id",memberdef_id);
1089 bindIntParameter(memberdef_param_insert,
":param_id",param_id);
1090 step(memberdef_param_insert);
1095 static void insertMemberDefineParams(
int memberdef_id,
const MemberDef *md,
const Definition *def)
1100 DBG_CTX((
"no params\n"));
1106 bindTextParameter(param_insert,
":defname",a.type);
1107 int param_id=step(param_insert,
TRUE);
1112 bindIntParameter(memberdef_param_insert,
":memberdef_id",memberdef_id);
1113 bindIntParameter(memberdef_param_insert,
":param_id",param_id);
1114 step(memberdef_param_insert);
1119 static void associateMember(
const MemberDef *md,
struct Refid member_refid,
struct Refid scope_refid)
1126 bindIntParameter(member_insert,
":scope_rowid", scope_refid.rowid);
1127 bindIntParameter(member_insert,
":memberdef_rowid", member_refid.rowid);
1129 bindIntParameter(member_insert,
":prot", md->
protection());
1130 bindIntParameter(member_insert,
":virt", md->
virtualness());
1131 step(member_insert);
1142 else if (typeStr==
"virtual") typeStr=
"";
1147 static int prepareStatement(sqlite3 *db, SqlStmt &s)
1150 rc = sqlite3_prepare_v2(db,s.query,-1,&s.stmt,0);
1153 err(
"prepare failed for:\n %s\n %s\n", s.query, sqlite3_errmsg(db));
1161 static int prepareStatements(sqlite3 *db)
1164 -1==prepareStatement(db, meta_insert) ||
1165 -1==prepareStatement(db, memberdef_exists) ||
1166 -1==prepareStatement(db, memberdef_incomplete) ||
1167 -1==prepareStatement(db, memberdef_insert) ||
1168 -1==prepareStatement(db, memberdef_update_def) ||
1169 -1==prepareStatement(db, memberdef_update_decl) ||
1170 -1==prepareStatement(db, member_insert) ||
1171 -1==prepareStatement(db, path_insert) ||
1172 -1==prepareStatement(db, path_select) ||
1173 -1==prepareStatement(db, refid_insert) ||
1174 -1==prepareStatement(db, refid_select) ||
1175 -1==prepareStatement(db, incl_insert)||
1176 -1==prepareStatement(db, incl_select)||
1177 -1==prepareStatement(db, param_insert) ||
1178 -1==prepareStatement(db, param_select) ||
1179 -1==prepareStatement(db, xrefs_insert) ||
1180 -1==prepareStatement(db, reimplements_insert) ||
1181 -1==prepareStatement(db, contains_insert) ||
1182 -1==prepareStatement(db, compounddef_exists) ||
1183 -1==prepareStatement(db, compounddef_insert) ||
1184 -1==prepareStatement(db, compoundref_insert) ||
1185 -1==prepareStatement(db, memberdef_param_insert)
1193 static void beginTransaction(sqlite3 *db)
1196 sqlite3_exec(db,
"BEGIN TRANSACTION", NULL, NULL, &sErrMsg);
1199 static void endTransaction(sqlite3 *db)
1202 sqlite3_exec(db,
"END TRANSACTION", NULL, NULL, &sErrMsg);
1205 static void pragmaTuning(sqlite3 *db)
1208 sqlite3_exec(db,
"PRAGMA synchronous = OFF", NULL, NULL, &sErrMsg);
1209 sqlite3_exec(db,
"PRAGMA journal_mode = MEMORY", NULL, NULL, &sErrMsg);
1210 sqlite3_exec(db,
"PRAGMA temp_store = MEMORY;", NULL, NULL, &sErrMsg);
1213 static int initializeTables(sqlite3* db)
1216 msg(
"Initializing DB schema (tables)...\n");
1217 for (
unsigned int k = 0; k <
sizeof(table_schema) /
sizeof(table_schema[0]); k++)
1219 const char *q = table_schema[k][1];
1221 rc = sqlite3_exec(db, q, NULL, NULL, &errmsg);
1222 if (rc != SQLITE_OK)
1224 err(
"failed to execute query: %s\n\t%s\n", q, errmsg);
1231 static int initializeViews(sqlite3* db)
1234 msg(
"Initializing DB schema (views)...\n");
1235 for (
unsigned int k = 0; k <
sizeof(view_schema) /
sizeof(view_schema[0]); k++)
1237 const char *q = view_schema[k][1];
1239 rc = sqlite3_exec(db, q, NULL, NULL, &errmsg);
1240 if (rc != SQLITE_OK)
1242 err(
"failed to execute query: %s\n\t%s\n", q, errmsg);
1264 for (
const auto &cd : cl)
1266 if (!cd->isHidden() && !cd->isAnonymous())
1268 struct Refid inner_refid = insertRefid(cd->getOutputFileBase());
1270 bindIntParameter(contains_insert,
":inner_rowid", inner_refid.rowid);
1271 bindIntParameter(contains_insert,
":outer_rowid", outer_refid.rowid);
1272 step(contains_insert);
1279 for (
const auto &pd : pl)
1281 struct Refid inner_refid = insertRefid(
1282 pd->getGroupDef() ? pd->getOutputFileBase()+
"_"+pd->name() : pd->getOutputFileBase()
1285 bindIntParameter(contains_insert,
":inner_rowid", inner_refid.rowid);
1286 bindIntParameter(contains_insert,
":outer_rowid", outer_refid.rowid);
1287 step(contains_insert);
1293 for (
const auto &sgd : gl)
1295 struct Refid inner_refid = insertRefid(sgd->getOutputFileBase());
1297 bindIntParameter(contains_insert,
":inner_rowid", inner_refid.rowid);
1298 bindIntParameter(contains_insert,
":outer_rowid", outer_refid.rowid);
1299 step(contains_insert);
1305 for (
const auto &fd: fl)
1307 struct Refid inner_refid = insertRefid(fd->getOutputFileBase());
1309 bindIntParameter(contains_insert,
":inner_rowid", inner_refid.rowid);
1310 bindIntParameter(contains_insert,
":outer_rowid", outer_refid.rowid);
1311 step(contains_insert);
1317 for (
const auto subdir : dl)
1319 struct Refid inner_refid = insertRefid(subdir->getOutputFileBase());
1321 bindIntParameter(contains_insert,
":inner_rowid", inner_refid.rowid);
1322 bindIntParameter(contains_insert,
":outer_rowid", outer_refid.rowid);
1323 step(contains_insert);
1329 for (
const auto &nd : nl)
1331 if (!nd->isHidden() && !nd->isAnonymous())
1333 struct Refid inner_refid = insertRefid(nd->getOutputFileBase());
1335 bindIntParameter(contains_insert,
":inner_rowid",inner_refid.rowid);
1336 bindIntParameter(contains_insert,
":outer_rowid",outer_refid.rowid);
1337 step(contains_insert);
1349 if (!a.type.isEmpty())
1352 bindTextParameter(param_select,
":type",a.type);
1353 bindTextParameter(param_insert,
":type",a.type);
1355 if (!a.name.isEmpty())
1357 bindTextParameter(param_select,
":declname",a.name);
1358 bindTextParameter(param_insert,
":declname",a.name);
1359 bindTextParameter(param_select,
":defname",a.name);
1360 bindTextParameter(param_insert,
":defname",a.name);
1362 if (!a.defval.isEmpty())
1365 bindTextParameter(param_select,
":defval",a.defval);
1366 bindTextParameter(param_insert,
":defval",a.defval);
1398 std::unique_ptr<DocRoot> root {
1415 auto visitor = std::make_unique<XmlDocVisitor>(t,codeGen,
1417 root->accept(visitor.get());
1421 static void getSQLDesc(SqlStmt &s,
const char *col,
const QCString &value,
const Definition *def)
1511 static void generateSqlite3ForMember(
const MemberDef *md,
struct Refid scope_refid,
const Definition *def)
1535 struct Refid refid = insertRefid(qrefid);
1537 associateMember(md, refid, scope_refid);
1540 if(!refid.created && memberdefExists(refid) && memberdefIncomplete(refid, md))
1550 struct SqlStmt memberdef_update;
1555 memberdef_update = memberdef_update_def;
1557 if (bodyfile_id == -1)
1559 sqlite3_clear_bindings(memberdef_update.stmt);
1563 bindIntParameter(memberdef_update,
":bodyfile_id",bodyfile_id);
1565 bindIntParameter(memberdef_update,
":bodyend",md->
getEndBodyLine());
1571 memberdef_update = memberdef_update_decl;
1577 bindIntParameter(memberdef_update,
":file_id",file_id);
1578 bindIntParameter(memberdef_update,
":line",md->
getDefLine());
1579 bindIntParameter(memberdef_update,
":column",md->
getDefColumn());
1584 bindIntParameter(memberdef_update,
":rowid", refid.rowid);
1586 bindIntParameter(memberdef_update,
":inline", 2);
1589 getSQLDesc(memberdef_update,
":briefdescription",md->
briefDescription(),md);
1590 getSQLDesc(memberdef_update,
":detaileddescription",md->
documentation(),md);
1593 step(memberdef_update,
TRUE);
1601 for (
const auto &rmd : refList)
1603 insertMemberReference(md,rmd,
"inline");
1607 for (
const auto &rmd : refByList)
1609 insertMemberReference(rmd,md,
"inline");
1614 bindIntParameter(memberdef_insert,
":rowid", refid.rowid);
1615 bindTextParameter(memberdef_insert,
":kind",md->
memberTypeName());
1616 bindIntParameter(memberdef_insert,
":prot",md->
protection());
1618 bindIntParameter(memberdef_insert,
":static",md->
isStatic());
1619 bindIntParameter(memberdef_insert,
":extern",md->
isExternal());
1640 bindIntParameter(memberdef_insert,
":explicit",md->
isExplicit());
1641 bindIntParameter(memberdef_insert,
":inline",md->
isInline());
1642 bindIntParameter(memberdef_insert,
":final",md->
isFinal());
1643 bindIntParameter(memberdef_insert,
":sealed",md->
isSealed());
1644 bindIntParameter(memberdef_insert,
":new",md->
isNew());
1645 bindIntParameter(memberdef_insert,
":optional",md->
isOptional());
1646 bindIntParameter(memberdef_insert,
":required",md->
isRequired());
1648 bindIntParameter(memberdef_insert,
":virt",md->
virtualness());
1653 bindIntParameter(memberdef_insert,
":mutable",md->
isMutable());
1654 bindIntParameter(memberdef_insert,
":initonly",md->
isInitonly());
1655 bindIntParameter(memberdef_insert,
":attribute",md->
isAttribute());
1656 bindIntParameter(memberdef_insert,
":property",md->
isProperty());
1657 bindIntParameter(memberdef_insert,
":readonly",md->
isReadonly());
1658 bindIntParameter(memberdef_insert,
":bound",md->
isBound());
1659 bindIntParameter(memberdef_insert,
":removable",md->
isRemovable());
1660 bindIntParameter(memberdef_insert,
":constrained",md->
isConstrained());
1661 bindIntParameter(memberdef_insert,
":transient",md->
isTransient());
1662 bindIntParameter(memberdef_insert,
":maybevoid",md->
isMaybeVoid());
1663 bindIntParameter(memberdef_insert,
":maybedefault",md->
isMaybeDefault());
1664 bindIntParameter(memberdef_insert,
":maybeambiguous",md->
isMaybeAmbiguous());
1668 if (bitfield.
at(0)==
':') bitfield=bitfield.
mid(1);
1669 bindTextParameter(memberdef_insert,
":bitfield",bitfield.
stripWhiteSpace());
1674 bindIntParameter(memberdef_insert,
":readable",md->
isReadable());
1675 bindIntParameter(memberdef_insert,
":writable",md->
isWritable());
1676 bindIntParameter(memberdef_insert,
":gettable",md->
isGettable());
1679 bindIntParameter(memberdef_insert,
":settable",md->
isSettable());
1688 else if (md->
isCopy()) accessor = 2;
1689 else if (md->
isRetain()) accessor = 3;
1690 else if (md->
isStrong()) accessor = 4;
1691 else if (md->
isWeak()) accessor = 5;
1693 bindIntParameter(memberdef_insert,
":accessor",accessor);
1700 bindIntParameter(memberdef_insert,
":addable",md->
isAddable());
1701 bindIntParameter(memberdef_insert,
":removable",md->
isRemovable());
1702 bindIntParameter(memberdef_insert,
":raisable",md->
isRaisable());
1710 struct Refid reimplemented_refid = insertRefid(qreimplemented_refid);
1712 bindIntParameter(reimplements_insert,
":memberdef_rowid", refid.rowid);
1713 bindIntParameter(reimplements_insert,
":reimplemented_rowid", reimplemented_refid.rowid);
1714 step(reimplements_insert,
TRUE);
1732 bindTextParameter(memberdef_insert,
":type",typeStr);
1737 bindTextParameter(memberdef_insert,
":definition",md->
definition());
1742 bindTextParameter(memberdef_insert,
":argsstring",md->
argsString());
1746 bindTextParameter(memberdef_insert,
":name",md->
name());
1751 bindTextParameter(memberdef_insert,
":initializer",md->
initializer());
1755 for (
const auto &s : list)
1759 DBG_CTX((
"initializer:%s %s %s %d\n",
1765 struct Refid src_refid = insertRefid(qsrc_refid);
1766 struct Refid dst_refid = insertRefid(s.c_str());
1767 insertMemberReference(src_refid,dst_refid,
"initializer");
1774 bindTextParameter(memberdef_insert,
":scope",md->
getScopeString());
1778 getSQLDesc(memberdef_insert,
":briefdescription",md->
briefDescription(),md);
1779 getSQLDesc(memberdef_insert,
":detaileddescription",md->
documentation(),md);
1788 bindIntParameter(memberdef_insert,
":file_id",file_id);
1789 bindIntParameter(memberdef_insert,
":line",md->
getDefLine());
1790 bindIntParameter(memberdef_insert,
":column",md->
getDefColumn());
1796 if (bodyfile_id == -1)
1798 sqlite3_clear_bindings(memberdef_insert.stmt);
1802 bindIntParameter(memberdef_insert,
":bodyfile_id",bodyfile_id);
1804 bindIntParameter(memberdef_insert,
":bodyend",md->
getEndBodyLine());
1810 int memberdef_id=step(memberdef_insert,
TRUE);
1814 insertMemberFunctionParams(memberdef_id,md,def);
1819 insertMemberDefineParams(memberdef_id,md,def);
1827 insertMemberReference(md,refmd,
"inline");
1832 insertMemberReference(refmd,md,
"inline");
1836 static void generateSqlite3Section(
const Definition *d,
1838 struct Refid scope_refid,
1844 for (
const auto &md : *ml)
1851 generateSqlite3ForMember(md, scope_refid, d);
1856 static void associateAllClassMembers(
const ClassDef *cd,
struct Refid scope_refid)
1860 for (
auto &mi : *mni)
1864 associateMember(md, insertRefid(qrefid), scope_refid);
1872 static void generateSqlite3ForClass(
const ClassDef *cd)
1901 if(!refid.created && compounddefExists(refid)){
return;}
1903 bindIntParameter(compounddef_insert,
":rowid", refid.rowid);
1905 bindTextParameter(compounddef_insert,
":name",cd->
name());
1906 bindTextParameter(compounddef_insert,
":title",cd->
title());
1908 bindIntParameter(compounddef_insert,
":prot",cd->
protection());
1911 bindIntParameter(compounddef_insert,
":file_id",file_id);
1912 bindIntParameter(compounddef_insert,
":line",cd->
getDefLine());
1913 bindIntParameter(compounddef_insert,
":column",cd->
getDefColumn());
1948 DBG_CTX((
"-----> ClassDef includeInfo for %s\n",
qPrint(nm)));
1949 DBG_CTX((
" local : %d\n", ii->local));
1950 DBG_CTX((
" imported : %d\n", ii->
imported));
1955 DBG_CTX((
" file_id : %d\n", file_id));
1956 DBG_CTX((
" header_id: %d\n", header_id));
1960 bindIntParameter(compounddef_insert,
":header_id",header_id);
1965 getSQLDesc(compounddef_insert,
":briefdescription",cd->
briefDescription(),cd);
1966 getSQLDesc(compounddef_insert,
":detaileddescription",cd->
documentation(),cd);
1968 step(compounddef_insert);
1973 struct Refid base_refid = insertRefid(bcd.classDef->getOutputFileBase());
1975 bindIntParameter(compoundref_insert,
":base_rowid", base_refid.rowid);
1976 bindIntParameter(compoundref_insert,
":derived_rowid", derived_refid.rowid);
1977 bindIntParameter(compoundref_insert,
":prot",bcd.prot);
1978 bindIntParameter(compoundref_insert,
":virt",bcd.virt);
1979 step(compoundref_insert);
1985 struct Refid derived_refid = insertRefid(bcd.classDef->getOutputFileBase());
1987 bindIntParameter(compoundref_insert,
":base_rowid", base_refid.rowid);
1988 bindIntParameter(compoundref_insert,
":derived_rowid", derived_refid.rowid);
1989 bindIntParameter(compoundref_insert,
":prot",bcd.prot);
1990 bindIntParameter(compoundref_insert,
":virt",bcd.virt);
1991 step(compoundref_insert);
2003 generateSqlite3Section(cd,&mg->members(),refid,
"user-defined",mg->header(),
2004 mg->documentation());
2012 generateSqlite3Section(cd,ml.get(),refid,
"user-defined");
2017 associateAllClassMembers(cd, refid);
2020 static void generateSqlite3ForConcept(
const ConceptDef *cd)
2025 if(!refid.created && compounddefExists(refid)){
return;}
2026 bindIntParameter(compounddef_insert,
":rowid", refid.rowid);
2027 bindTextParameter(compounddef_insert,
":name",cd->
name());
2028 bindTextParameter(compounddef_insert,
":kind",
"concept");
2031 bindIntParameter(compounddef_insert,
":file_id",file_id);
2032 bindIntParameter(compounddef_insert,
":line",cd->
getDefLine());
2033 bindIntParameter(compounddef_insert,
":column",cd->
getDefColumn());
2035 getSQLDesc(compounddef_insert,
":briefdescription",cd->
briefDescription(),cd);
2036 getSQLDesc(compounddef_insert,
":detaileddescription",cd->
documentation(),cd);
2038 step(compounddef_insert);
2045 static void generateSqlite3ForNamespace(
const NamespaceDef *nd)
2058 if(!refid.created && compounddefExists(refid)){
return;}
2059 bindIntParameter(compounddef_insert,
":rowid", refid.rowid);
2061 bindTextParameter(compounddef_insert,
":name",nd->
name());
2062 bindTextParameter(compounddef_insert,
":title",nd->
title());
2063 bindTextParameter(compounddef_insert,
":kind",
"namespace");
2066 bindIntParameter(compounddef_insert,
":file_id",file_id);
2067 bindIntParameter(compounddef_insert,
":line",nd->
getDefLine());
2068 bindIntParameter(compounddef_insert,
":column",nd->
getDefColumn());
2070 getSQLDesc(compounddef_insert,
":briefdescription",nd->
briefDescription(),nd);
2071 getSQLDesc(compounddef_insert,
":detaileddescription",nd->
documentation(),nd);
2073 step(compounddef_insert);
2084 generateSqlite3Section(nd,&mg->members(),refid,
"user-defined",mg->header(),
2085 mg->documentation());
2093 generateSqlite3Section(nd,ml.get(),refid,
"user-defined");
2099 static void generateSqlite3ForFile(
const FileDef *fd)
2118 if(!refid.created && compounddefExists(refid)){
return;}
2119 bindIntParameter(compounddef_insert,
":rowid", refid.rowid);
2121 bindTextParameter(compounddef_insert,
":name",fd->
name());
2122 bindTextParameter(compounddef_insert,
":title",fd->
title());
2123 bindTextParameter(compounddef_insert,
":kind",
"file");
2126 bindIntParameter(compounddef_insert,
":file_id",file_id);
2127 bindIntParameter(compounddef_insert,
":line",fd->
getDefLine());
2128 bindIntParameter(compounddef_insert,
":column",fd->
getDefColumn());
2130 getSQLDesc(compounddef_insert,
":briefdescription",fd->
briefDescription(),fd);
2131 getSQLDesc(compounddef_insert,
":detaileddescription",fd->
documentation(),fd);
2133 step(compounddef_insert);
2155 dst_id = insertPath(dst_path,ii.local);
2163 DBG_CTX((
" local: %d\n", ii.local));
2164 DBG_CTX((
" imported: %d\n", ii.
imported));
2169 DBG_CTX((
" src_id : %d\n", src_id));
2170 DBG_CTX((
" dst_id: %d\n", dst_id));
2172 bindIntParameter(incl_select,
":local",ii.local);
2173 bindIntParameter(incl_select,
":src_id",src_id);
2174 bindIntParameter(incl_select,
":dst_id",dst_id);
2175 if (step(incl_select,
TRUE,
TRUE)==0) {
2176 bindIntParameter(incl_insert,
":local",ii.local);
2177 bindIntParameter(incl_insert,
":src_id",src_id);
2178 bindIntParameter(incl_insert,
":dst_id",dst_id);
2203 src_id = insertPath(src_path,ii.local);
2210 bindIntParameter(incl_select,
":local",ii.local);
2211 bindIntParameter(incl_select,
":src_id",src_id);
2212 bindIntParameter(incl_select,
":dst_id",dst_id);
2213 if (step(incl_select,
TRUE,
TRUE)==0) {
2214 bindIntParameter(incl_insert,
":local",ii.local);
2215 bindIntParameter(incl_insert,
":src_id",src_id);
2216 bindIntParameter(incl_insert,
":dst_id",dst_id);
2230 generateSqlite3Section(fd,&mg->members(),refid,
"user-defined",mg->header(),
2231 mg->documentation());
2239 generateSqlite3Section(fd,ml.get(),refid,
"user-defined");
2245 static void generateSqlite3ForGroup(
const GroupDef *gd)
2262 if(!refid.created && compounddefExists(refid)){
return;}
2263 bindIntParameter(compounddef_insert,
":rowid", refid.rowid);
2265 bindTextParameter(compounddef_insert,
":name",gd->
name());
2266 bindTextParameter(compounddef_insert,
":title",gd->
groupTitle());
2267 bindTextParameter(compounddef_insert,
":kind",
"group");
2270 bindIntParameter(compounddef_insert,
":file_id",file_id);
2271 bindIntParameter(compounddef_insert,
":line",gd->
getDefLine());
2272 bindIntParameter(compounddef_insert,
":column",gd->
getDefColumn());
2274 getSQLDesc(compounddef_insert,
":briefdescription",gd->
briefDescription(),gd);
2275 getSQLDesc(compounddef_insert,
":detaileddescription",gd->
documentation(),gd);
2277 step(compounddef_insert);
2297 generateSqlite3Section(gd,&mg->members(),refid,
"user-defined",mg->header(),
2298 mg->documentation());
2306 generateSqlite3Section(gd,ml.get(),refid,
"user-defined");
2312 static void generateSqlite3ForDir(
const DirDef *dd)
2322 if(!refid.created && compounddefExists(refid)){
return;}
2323 bindIntParameter(compounddef_insert,
":rowid", refid.rowid);
2325 bindTextParameter(compounddef_insert,
":name",dd->
displayName());
2326 bindTextParameter(compounddef_insert,
":kind",
"dir");
2329 bindIntParameter(compounddef_insert,
":file_id",file_id);
2341 bindIntParameter(compounddef_insert,
":line",dd->
getDefLine());
2342 bindIntParameter(compounddef_insert,
":column",dd->
getDefColumn());
2344 getSQLDesc(compounddef_insert,
":briefdescription",dd->
briefDescription(),dd);
2345 getSQLDesc(compounddef_insert,
":detaileddescription",dd->
documentation(),dd);
2347 step(compounddef_insert);
2357 static void generateSqlite3ForPage(
const PageDef *pd,
bool isExample)
2374 if (qrefid==
"index") qrefid=
"indexpage";
2376 struct Refid refid = insertRefid(qrefid);
2379 if(!refid.created && compounddefExists(refid)){
return;}
2381 bindIntParameter(compounddef_insert,
":rowid",refid.rowid);
2383 bindTextParameter(compounddef_insert,
":name",pd->
name());
2402 title = si->
title();
2406 title = pd->
title();
2411 bindTextParameter(compounddef_insert,
":title",title);
2413 bindTextParameter(compounddef_insert,
":kind", isExample ?
"example" :
"page",
TRUE);
2417 bindIntParameter(compounddef_insert,
":file_id",file_id);
2418 bindIntParameter(compounddef_insert,
":line",pd->
getDefLine());
2419 bindIntParameter(compounddef_insert,
":column",pd->
getDefColumn());
2422 getSQLDesc(compounddef_insert,
":briefdescription",pd->
briefDescription(),pd);
2424 getSQLDesc(compounddef_insert,
":detaileddescription",pd->
documentation(),pd);
2426 step(compounddef_insert);
2432 static sqlite3* openDbConnection()
2439 rc = sqlite3_initialize();
2440 if (rc != SQLITE_OK)
2442 err(
"sqlite3_initialize failed\n");
2446 std::string dbFileName =
"doxygen_sqlite3.db";
2447 FileInfo fi(outputDirectory.
str()+
"/"+dbFileName);
2457 err(
"doxygen_sqlite3.db already exists! Rename, remove, or archive it to regenerate\n");
2462 rc = sqlite3_open_v2(
2463 fi.absFilePath().c_str(),
2465 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
2468 if (rc != SQLITE_OK)
2471 err(
"Database open failed: %s\n",
"doxygen_sqlite3.db");
2488 db = openDbConnection();
2494 # ifdef SQLITE3_DEBUG
2496 sqlite3_trace(db, &sqlLog, NULL);
2499 beginTransaction(db);
2502 if (-1==initializeTables(db))
2505 if ( -1 == prepareStatements(db) )
2507 err(
"sqlite generator: prepareStatements failed!\n");
2516 msg(
"Generating Sqlite3 output for class %s\n",
qPrint(cd->
name()));
2517 generateSqlite3ForClass(cd.get());
2523 msg(
"Generating Sqlite3 output for concept %s\n",
qPrint(cd->
name()));
2524 generateSqlite3ForConcept(cd.get());
2530 msg(
"Generating Sqlite3 output for namespace %s\n",
qPrint(nd->
name()));
2531 generateSqlite3ForNamespace(nd.get());
2537 for (
const auto &fd : *fn)
2539 msg(
"Generating Sqlite3 output for file %s\n",
qPrint(fd->
name()));
2540 generateSqlite3ForFile(fd.get());
2547 msg(
"Generating Sqlite3 output for group %s\n",
qPrint(gd->
name()));
2548 generateSqlite3ForGroup(gd.get());
2554 msg(
"Generating Sqlite3 output for page %s\n",
qPrint(pd->
name()));
2555 generateSqlite3ForPage(pd.get(),
FALSE);
2561 msg(
"Generating Sqlite3 output for dir %s\n",
qPrint(dd->
name()));
2562 generateSqlite3ForDir(dd.get());
2568 msg(
"Generating Sqlite3 output for example %s\n",
qPrint(pd->
name()));
2569 generateSqlite3ForPage(pd.get(),
TRUE);
2575 msg(
"Generating Sqlite3 output for the main page\n");
2581 if (-1==initializeViews(db))
2587 #else // USE_SQLITE3
2590 err(
"sqlite3 support has not been compiled in!\n");