Add initial source codes for gtest
[platform/core/connectivity/stc-manager.git] / src / database / tables / table-counters.c
index f8946f7..11c99a4 100755 (executable)
@@ -91,8 +91,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_counter, DELETE_COUNTER);
@@ -118,8 +118,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_counter, SELECT_COUNTER);
@@ -145,8 +145,8 @@ static int __prepare_update(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_counter, UPDATE_COUNTER);
@@ -182,6 +182,7 @@ stc_error_e table_counters_get(uint64_t restriction_id,
        do {
                rc = sqlite3_step(stmt);
 
+                //LCOV_EXCL_START
                switch (rc) {
                case SQLITE_DONE:
                        break;
@@ -198,6 +199,7 @@ stc_error_e table_counters_get(uint64_t restriction_id,
 
                        error_code = STC_ERROR_DB_FAILED;
                }
+                //LCOV_EXCL_STOP
        } while (rc == SQLITE_ROW);
 
 handle_error:
@@ -205,6 +207,7 @@ handle_error:
        return error_code;
 }
 
+//LCOV_EXCL_START
 stc_error_e table_counters_update_counters(const table_counters_info *info)
 {
        stc_error_e error_code = STC_ERROR_NONE;
@@ -233,6 +236,7 @@ handle_error:
        sqlite3_reset(stmt);
        return error_code;
 }
+//LCOV_EXCL_STOP
 
 stc_error_e table_counters_delete(uint64_t restriction_id)
 {
@@ -242,10 +246,10 @@ stc_error_e table_counters_delete(uint64_t restriction_id)
        DB_ACTION(sqlite3_bind_int64(stmt, 1, restriction_id));
 
        if (sqlite3_step(stmt) != SQLITE_DONE) {
-               STC_LOGE("Failed to delete counter: %s\n",
+               STC_LOGE("Failed to delete counter: %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("Counter deleted for restriction_id [%llu]", restriction_id);
@@ -262,8 +266,8 @@ stc_error_e table_counters_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));