Code cleanup
authorj-h.choi <j-h.choi@samsung.com>
Thu, 10 Oct 2019 05:40:43 +0000 (14:40 +0900)
committer이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자 <leee.lee@samsung.com>
Thu, 10 Oct 2019 23:36:22 +0000 (08:36 +0900)
NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc
NativeLauncher/tool/dotnettool.cc

index 9e6c06b..8d15f6b 100644 (file)
@@ -328,12 +328,12 @@ static int sqliteCb(void *count, int argc, char **argv, char **colName) {
        return 0;
 }
 
-int updateTacDB(const char *pkgId)
+int updateTacDB(sqlite3 *sqlite)
 {
        for (auto& unp : updateTac) {
                int count = -1;
                std::string sql = "SELECT COUNT(NUGET) FROM TAC WHERE NUGET = '" + unp + "';";
-               int ret = sqlite3_exec(tac_db, sql.c_str(), sqliteCb, &count, NULL);
+               int ret = sqlite3_exec(sqlite, sql.c_str(), sqliteCb, &count, NULL);
                if (ret != SQLITE_OK) {
                        _ERR("Sqlite select error");
                        return -1;
@@ -389,7 +389,7 @@ extern "C" int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char *pkgId, const char *app
        if (tacDB.empty()) {
                std::string sql = "DELETE FROM TAC WHERE PKGID = '" + std::string(pkgId) + "';";
                dbDelete(tac_db, TAC_APP_LIST_DB, sql);
-               if (updateTacDB(pkgId) < 0) {
+               if (updateTacDB(tac_db) < 0) {
                        return -1;
                }
        } else {
@@ -517,7 +517,7 @@ extern "C" int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char *pkgId, const char *app
                                dbDelete(tac_db, TAC_APP_LIST_DB, sql);
                        }
                }
-               if (updateTacDB(pkgId) < 0) {
+               if (updateTacDB(tac_db) < 0) {
                        return -1;
                }
        }
@@ -542,7 +542,7 @@ extern "C" int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(const char *pkgId, const char *a
        sql = "DELETE FROM TAC WHERE PKGID = '" + std::string(pkgId) + "';";
        dbDelete(tac_db, TAC_APP_LIST_DB, sql);
 
-       if (updateTacDB(pkgId) < 0) {
+       if (updateTacDB(tac_db) < 0) {
                return -1;
        }
        return 0;
index 3699372..8f842d0 100644 (file)
  * limitations under the License.
  */
 
-#include "log.h"
 #include "utils.h"
-#include "db_manager.h"
 #include "ni_common.h"
 #include "tac_common.h"
 
 #include <algorithm>
 #include <cstdio>
 #include <cstring>
-#include <fstream>
 #include <vector>
 
-#include <pkgmgr-info.h>
-#include <pkgmgr_installer_info.h>
-
-#ifdef  LOG_TAG
-#undef  LOG_TAG
-#endif
-#define LOG_TAG "DOTNET_INSTALLER_PLUGIN"
-
 std::vector<std::string> getCmdArgs(char** begin, char** end)
 {
        std::vector<std::string> list;