Fixed restriction update logic, when user data limit of a restriction. 13/136513/2
authorNishant Chaprana <n.chaprana@samsung.com>
Fri, 30 Jun 2017 05:17:29 +0000 (10:47 +0530)
committerhyunuktak <hyunuk.tak@samsung.com>
Mon, 3 Jul 2017 02:08:59 +0000 (11:08 +0900)
Change-Id: I1784d6ad9485f2ebc21c26cc1e3941594b12ca04
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
packaging/stc-manager.spec
src/database/tables/table-restrictions.c

index cfd59dd..0470c0c 100644 (file)
@@ -1,6 +1,6 @@
 Name:       stc-manager
 Summary:    STC(Smart Traffic Control) manager
-Version:    0.0.19
+Version:    0.0.20
 Release:    0
 Group:      Network & Connectivity/Other
 License:    Apache-2.0
index a5cb108..e1e7256 100755 (executable)
@@ -49,7 +49,6 @@
 
 #define SELECT_RESTRICTION_ID "SELECT restriction_id FROM restrictions " \
        " WHERE binpath = ? AND iftype = ? AND imsi = ? AND " \
-       " data_limit = ? AND data_warn_limit = ? AND " \
        " rst_state = ? AND roaming = ? AND ifname = ?"
 
 /* UPDATE statement */
@@ -476,11 +475,9 @@ stc_error_e __get_restriction_id(table_restrictions_info *info)
        DB_ACTION(sqlite3_bind_int(stmt, 2, info->iftype));
        DB_ACTION(sqlite3_bind_text(stmt, 3, info->imsi ? info->imsi : "",
                                    -1, SQLITE_TRANSIENT));
-       DB_ACTION(sqlite3_bind_int64(stmt, 4, info->data_limit));
-       DB_ACTION(sqlite3_bind_int64(stmt, 5, info->data_warn_limit));
-       DB_ACTION(sqlite3_bind_int(stmt, 6, info->rst_state));
-       DB_ACTION(sqlite3_bind_int(stmt, 7, info->roaming));
-       DB_ACTION(sqlite3_bind_text(stmt, 8, info->ifname ? info->ifname : "",
+       DB_ACTION(sqlite3_bind_int(stmt, 4, info->rst_state));
+       DB_ACTION(sqlite3_bind_int(stmt, 5, info->roaming));
+       DB_ACTION(sqlite3_bind_text(stmt, 6, info->ifname ? info->ifname : "",
                                    -1, SQLITE_TRANSIENT));
 
        rc = sqlite3_step(stmt);
@@ -514,6 +511,7 @@ stc_error_e table_restrictions_update(table_restrictions_info *info)
                goto handle_error;
        }
 
+       __get_restriction_id(info);
        if (info->restriction_id)
                stmt = update_net_restrictions;
 
@@ -530,7 +528,7 @@ stc_error_e table_restrictions_update(table_restrictions_info *info)
        DB_ACTION(sqlite3_bind_int64(stmt, 8, info->data_warn_limit));
 
        if (info->restriction_id)
-               DB_ACTION(sqlite3_bind_int64(stmt, 11, info->restriction_id));
+               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",