Change query from insert to replace 26/270926/2
authorSukhyungKang <shine.kang@samsung.com>
Fri, 11 Feb 2022 07:00:01 +0000 (16:00 +0900)
committerSukhyungKang <shine.kang@samsung.com>
Fri, 11 Feb 2022 07:00:34 +0000 (16:00 +0900)
Change-Id: Ie3bc8e3a5efdf6570887ffc4272393a534fcfc13
Signed-off-by: SukhyungKang <shine.kang@samsung.com>
mock/db_mock.cc
parser/widget_plugin_parser_db.c

index ca3943a..9420e6c 100644 (file)
@@ -97,7 +97,7 @@ int insert_widget_class(sqlite3 *db) {
        char *query = nullptr;
        sqlite3_stmt *stmt = nullptr;
 
-       query = sqlite3_mprintf("INSERT INTO widget_class "
+       query = sqlite3_mprintf("INSERT OR REPLACE INTO widget_class "
                "(classid, setup_appid, appid, pkgid, prime, nodisplay, max_instance) "
                "VALUES (%Q, %Q, %Q, %Q, %d, %d, %d)",
                "org.tizen.test_widget", "org.tizen.setup_appid", "org.tizen.test_appid",
@@ -135,7 +135,7 @@ int insert_support_size(sqlite3 *db) {
        char *query = nullptr;
        sqlite3_stmt *stmt = nullptr;
 
-       query = sqlite3_mprintf("INSERT INTO support_size "
+       query = sqlite3_mprintf("INSERT OR REPLACE INTO support_size "
                "(classid, preview, width, height) "
                "VALUES (%Q, %Q, %d, %d)",
                "org.tizen.test_widget", "/unittest/preview.png", 4, 2);
@@ -172,7 +172,7 @@ int insert_label(sqlite3 *db) {
        char *query = nullptr;
        sqlite3_stmt *stmt = nullptr;
 
-       query = sqlite3_mprintf("INSERT INTO label "
+       query = sqlite3_mprintf("INSERT OR REPLACE INTO label "
                "(classid, locale, label) "
                "VALUES (%Q, %Q, %Q)",
                "org.tizen.test_widget", "en-us", "TestWidget");
@@ -209,7 +209,7 @@ int insert_icon(sqlite3 *db) {
        char *query = nullptr;
        sqlite3_stmt *stmt = nullptr;
 
-       query = sqlite3_mprintf("INSERT INTO icon "
+       query = sqlite3_mprintf("INSERT OR REPLACE INTO icon "
                "(classid, locale, icon) "
                "VALUES (%Q, %Q, %Q)",
                "org.tizen.test_widget", "en-us", "/unittest/icon.png");
index 9095720..bc3467e 100644 (file)
@@ -93,7 +93,7 @@ static int _insert_support_size(sqlite3 *db, const char *pkgid,
 {
        int ret;
        static const char query[] =
-               "INSERT INTO support_size "
+               "INSERT OR REPLACE INTO support_size "
                "(classid, preview, frame, width, height) "
                "VALUES (?, ?, ?, ?, ?)";
        GList *tmp;
@@ -150,7 +150,7 @@ static int _insert_label(sqlite3 *db, const char *classid, GList *labels)
 {
        int ret;
        static const char query[] =
-               "INSERT INTO label (classid, locale, label) "
+               "INSERT OR REPLACE INTO label (classid, locale, label) "
                "VALUES (?, ?, ?)";
        GList *tmp;
        struct label *label;
@@ -192,7 +192,7 @@ static int _insert_icon(sqlite3 *db, const char *pkgid,
 {
        int ret;
        static const char query[] =
-               "INSERT INTO icon (classid, locale, icon) "
+               "INSERT OR REPLACE INTO icon (classid, locale, icon) "
                "VALUES (?, ?, ?)";
        GList *tmp;
        struct icon *icon;
@@ -241,7 +241,7 @@ static int _insert_widget_class(sqlite3 *db, const char *pkgid, GList *wcs)
 {
        int ret;
        static const char query[] =
-               "INSERT INTO widget_class (classid, update_period, "
+               "INSERT OR REPLACE INTO widget_class (classid, update_period, "
                "setup_appid, appid, pkgid, nodisplay, max_instance, prime) "
                "VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
        GList *tmp;