Add initial source codes for gtest
[platform/core/connectivity/stc-manager.git] / src / database / tables / table-restrictions.c
index 9324887..1c717e4 100755 (executable)
@@ -145,8 +145,8 @@ static int __prepare_delete(sqlite3 *db)
        static int initialized;
 
        if (initialized) {
-               __STC_LOG_FUNC_EXIT__;
-               return SQLITE_OK;
+               __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+               return SQLITE_OK; //LCOV_EXCL_LINE
        }
 
        PREPARE_DELETE(delete_restrictions, DELETE_RESTRICTIONS);
@@ -172,8 +172,8 @@ static int __prepare_select(sqlite3 *db)
        static int initialized;
 
        if (initialized) {
-               __STC_LOG_FUNC_EXIT__;
-               return SQLITE_OK;
+               __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+               return SQLITE_OK; //LCOV_EXCL_LINE
        }
 
        PREPARE_SELECT(select_restriction, SELECT_RESTRICTIONS);
@@ -207,8 +207,8 @@ static int __prepare_replace(sqlite3 *db)
        static int initialized;
 
        if (initialized) {
-               __STC_LOG_FUNC_EXIT__;
-               return SQLITE_OK;
+               __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+               return SQLITE_OK; //LCOV_EXCL_LINE
        }
 
        PREPARE_UPDATE(update_net_restrictions, UPDATE_NET_RESTRICTIONS);
@@ -234,8 +234,8 @@ static int __prepare_insert(sqlite3 *db)
        static int initialized;
 
        if (initialized) {
-               __STC_LOG_FUNC_EXIT__;
-               return SQLITE_OK;
+               __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+               return SQLITE_OK; //LCOV_EXCL_LINE
        }
 
        PREPARE_UPDATE(insert_net_restrictions, INSERT_NET_RESTRICTIONS);
@@ -265,8 +265,8 @@ stc_error_e table_restrictions_per_app(const gchar* app_id,
        sqlite3_stmt *stmt = select_restriction_per_app;
 
        if (!app_id) {
-               __STC_LOG_FUNC_EXIT__;
-               return STC_ERROR_DB_FAILED;
+               __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+               return STC_ERROR_DB_FAILED; //LCOV_EXCL_LINE
        }
 
        DB_ACTION(sqlite3_bind_text(stmt, 1, app_id, -1,
@@ -294,15 +294,15 @@ stc_error_e table_restrictions_per_app(const gchar* app_id,
                        data.restriction_id = sqlite3_column_int64(stmt, 8);
 
                        if (restriction_cb(&data, user_data) == STC_CANCEL)
-                               rc = SQLITE_DONE;
+                               rc = SQLITE_DONE; //LCOV_EXCL_LINE
                        break;
                case SQLITE_ERROR:
                default:
-                       STC_LOGE("Failed to enumerate restrictions: %s\n",
+                       STC_LOGE("Failed to enumerate restrictions: %s\n", //LCOV_EXCL_LINE
                                 sqlite3_errmsg(stc_db_get_database()));
 
-                       __STC_LOG_FUNC_EXIT__;
-                       error_code = STC_ERROR_DB_FAILED;
+                       __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+                       error_code = STC_ERROR_DB_FAILED; //LCOV_EXCL_LINE
                }
        } while (rc == SQLITE_ROW);
 
@@ -342,15 +342,15 @@ stc_error_e table_restrictions_foreach(const table_restrictions_info_cb restrict
                        data.restriction_id = sqlite3_column_int64(stmt, 8);
 
                        if (restriction_cb(&data, user_data) == STC_CANCEL)
-                               rc = SQLITE_DONE;
+                               rc = SQLITE_DONE; //LCOV_EXCL_LINE
                        break;
                case SQLITE_ERROR:
                default:
-                       STC_LOGE("Failed to enumerate restrictions: %s\n",
+                       STC_LOGE("Failed to enumerate restrictions: %s\n", //LCOV_EXCL_LINE
                                 sqlite3_errmsg(stc_db_get_database()));
 
-                       __STC_LOG_FUNC_EXIT__;
-                       error_code = STC_ERROR_DB_FAILED;
+                       __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+                       error_code = STC_ERROR_DB_FAILED; //LCOV_EXCL_LINE
                }
        } while (rc == SQLITE_ROW);
 
@@ -370,9 +370,9 @@ stc_error_e table_restrictions_get_restriction_state_subscriber_id(const char *a
        bool state_subscriber_id = 0;
 
        if (state == NULL) {
-               STC_LOGE("Please provide valid argument!");
-               __STC_LOG_FUNC_EXIT__;
-               return STC_ERROR_INVALID_PARAMETER;
+               STC_LOGE("Please provide valid argument!"); //LCOV_EXCL_LINE
+               __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+               return STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        *state = STC_RESTRICTION_UNKNOWN;
@@ -410,10 +410,10 @@ stc_error_e table_restrictions_get_restriction_state_subscriber_id(const char *a
                break;
        case SQLITE_ERROR:
        default:
-               STC_LOGE("Can't perform sql query: %s \n%s",
+               STC_LOGE("Can't perform sql query: %s \n%s", //LCOV_EXCL_LINE
                         SELECT_RESTRICTION_STATE,
                         sqlite3_errmsg(stc_db_get_database()));
-               error_code = STC_ERROR_DB_FAILED;
+               error_code = STC_ERROR_DB_FAILED; //LCOV_EXCL_LINE
        }
 
 handle_error:
@@ -449,10 +449,10 @@ stc_error_e table_restrictions_delete(const char *app_id,
                                    SQLITE_TRANSIENT));
 
        if (sqlite3_step(stmt) != SQLITE_DONE) {
-               STC_LOGE("Failed to remove restrictions by network interface %s\n",
+               STC_LOGE("Failed to remove restrictions by network interface %s\n", //LCOV_EXCL_LINE
                         sqlite3_errmsg(stc_db_get_database()));
-               error_code = STC_ERROR_DB_FAILED;
-               goto handle_error;
+               error_code = STC_ERROR_DB_FAILED; //LCOV_EXCL_LINE
+               goto handle_error; //LCOV_EXCL_LINE
        }
 
        STC_LOGD("Restriction deleted for app_id [%s]", app_id);
@@ -491,7 +491,7 @@ stc_error_e __get_restriction_id(table_restrictions_info *info)
                break;
        case SQLITE_ERROR:
        default:
-               STC_LOGE("Failed to get restriction id: %s\n",
+               STC_LOGE("Failed to get restriction id: %s\n", //LCOV_EXCL_LINE
                         sqlite3_errmsg(stc_db_get_database()));
        }
 
@@ -507,8 +507,8 @@ stc_error_e table_restrictions_update(table_restrictions_info *info)
        sqlite3_stmt *stmt = insert_net_restrictions;
 
        if (!info) {
-               error_code = STC_ERROR_INVALID_PARAMETER;
-               goto handle_error;
+               error_code = STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+               goto handle_error; //LCOV_EXCL_LINE
        }
 
        __get_restriction_id(info);
@@ -531,10 +531,10 @@ stc_error_e table_restrictions_update(table_restrictions_info *info)
                DB_ACTION(sqlite3_bind_int64(stmt, 9, info->restriction_id));
 
        if (sqlite3_step(stmt) != SQLITE_DONE) {
-               STC_LOGE("Failed to set network restriction: %s\n",
+               STC_LOGE("Failed to set network restriction: %s\n", //LCOV_EXCL_LINE
                         sqlite3_errmsg(stc_db_get_database()));
-               error_code = STC_ERROR_DB_FAILED;
-               goto handle_error;
+               error_code = STC_ERROR_DB_FAILED; //LCOV_EXCL_LINE
+               goto handle_error; //LCOV_EXCL_LINE
        }
 
        if (info->restriction_id) {
@@ -556,8 +556,8 @@ stc_error_e table_restrictions_prepare(sqlite3 *db)
        stc_error_e error_code = STC_ERROR_NONE;
 
        if (db == NULL) {
-               __STC_LOG_FUNC_EXIT__;
-               return STC_ERROR_FAIL;
+               __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+               return STC_ERROR_FAIL; //LCOV_EXCL_LINE
        }
 
        DB_ACTION(__prepare_delete(db));