diff options
author | Adrian Negreanu <groleo@gmail.com> | 2017-09-29 08:51:52 (GMT) |
---|---|---|
committer | Adrian Negreanu <groleo@gmail.com> | 2017-10-25 10:46:53 (GMT) |
commit | 5596fcd158e7c53638324cea8ba3da31b2c32620 (patch) | |
tree | 949399c2a01db20d47d34e29c5a220465a78f547 /src/sqlite3gen.cpp | |
parent | 1308178b6787e6cfadc49972236e3c6f03b2ee3e (diff) | |
download | Doxygen-5596fcd158e7c53638324cea8ba3da31b2c32620.zip Doxygen-5596fcd158e7c53638324cea8ba3da31b2c32620.tar.gz Doxygen-5596fcd158e7c53638324cea8ba3da31b2c32620.tar.bz2 |
sqlite3gen: add openDbConnection
Diffstat (limited to 'src/sqlite3gen.cpp')
-rw-r--r-- | src/sqlite3gen.cpp | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp index 90b96ca..c37adc0 100644 --- a/src/sqlite3gen.cpp +++ b/src/sqlite3gen.cpp @@ -1424,6 +1424,31 @@ static void generateSqlite3ForPage(sqlite3 *db,const PageDef *pd,bool isExample) { #warning WorkInProgress } + + +static sqlite3* openDbConnection() +{ + + QCString outputDirectory = Config_getString(OUTPUT_DIRECTORY); + QDir sqlite3Dir(outputDirectory); + sqlite3 *db; + int rc; + + rc = sqlite3_initialize(); + if (rc != SQLITE_OK) + { + msg("sqlite3_initialize failed\n"); + return NULL; + } + rc = sqlite3_open_v2(outputDirectory+"/doxygen_sqlite3.db", &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0); + if (rc != SQLITE_OK) + { + sqlite3_close(db); + msg("database open failed: %s\n", "doxygen_sqlite3.db"); + return NULL; + } + return db; +} ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// void generateSqlite3() @@ -1435,16 +1460,11 @@ void generateSqlite3() // + related pages // + examples // + main page - - QCString outputDirectory = Config_getString(OUTPUT_DIRECTORY); - QDir sqlite3Dir(outputDirectory); sqlite3 *db; - sqlite3_initialize(); - int rc = sqlite3_open_v2(outputDirectory+"/doxygen_sqlite3.db", &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0); - if (rc != SQLITE_OK) + + db = openDbConnection(); + if (db==NULL) { - sqlite3_close(db); - msg("database open failed: %s\n", "doxygen_sqlite3.db"); return; } beginTransaction(db); |