static int __is_iftype_defined(const stc_iface_type_e iftype)
{
- __STC_LOG_FUNC_ENTER__;
- __STC_LOG_FUNC_EXIT__;
return iftype < STC_IFACE_LAST_ELEM &&
iftype > STC_IFACE_UNKNOWN &&
iftype != STC_IFACE_ALL;
static sqlite3_stmt *__select_statement(const char *app_id,
const table_statistics_select_rule *rule)
{
- __STC_LOG_FUNC_ENTER__;
const int stm_index = __is_iftype_defined(rule->iftype) |
((strlen(app_id) > 0) ? 0 : 2) | (rule->granularity ? 4 : 0);
STC_LOGD("stm index %d", stm_index);
- __STC_LOG_FUNC_EXIT__;
return *details_stms[stm_index];
}
if (info_cb(&data, user_data) == STC_CANCEL)
rc = SQLITE_DONE; //LCOV_EXCL_LINE
- __STC_LOG_FUNC_EXIT__;
break;
case SQLITE_DONE:
- __STC_LOG_FUNC_EXIT__;
break;
case SQLITE_ERROR:
default:
error_code = STC_ERROR_DB_FAILED; //LCOV_EXCL_LINE
- __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
break; //LCOV_EXCL_LINE
}
} while (rc == SQLITE_ROW);
if (info_cb(&data, user_data) == STC_CANCEL)
rc = SQLITE_DONE; //LCOV_EXCL_LINE
- __STC_LOG_FUNC_EXIT__;
break;
case SQLITE_DONE:
- __STC_LOG_FUNC_EXIT__;
break;
case SQLITE_ERROR:
default:
error_code = STC_ERROR_DB_FAILED; //LCOV_EXCL_LINE
- __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
break; //LCOV_EXCL_LINE
}
} while (rc == SQLITE_ROW);
{
stc_error_e error_code = STC_ERROR_NONE;
sqlite3_stmt *stmt = update_statistics_query;
- stc_hw_net_protocol_type_e hw_net_protocol_type = STC_PROTOCOL_NONE;
+ stc_hw_net_protocol_type_e hw_net_protocol_type = STC_PROTOCOL_UNKNOWN;
+ int64_t rcv;
+ int64_t snd;
if (!stat->rcv_count && !stat->snd_count) {
error_code = STC_ERROR_INVALID_PARAMETER;
SQLITE_STATIC));
DB_ACTION(sqlite3_bind_int(stmt, 2, stat->rcv_count));
DB_ACTION(sqlite3_bind_int(stmt, 3, stat->snd_count));
- DB_ACTION(sqlite3_bind_int64(stmt, 4,
- (sqlite3_int64)(last_touch_time)));
+ DB_ACTION(sqlite3_bind_int64(stmt, 4, (sqlite3_int64)last_touch_time));
DB_ACTION(sqlite3_bind_int(stmt, 5, (int)(stat_key->iftype)));
DB_ACTION(sqlite3_bind_int(stmt, 6, (int)(stat->is_roaming)));
DB_ACTION(sqlite3_bind_int(stmt, 7, (int)hw_net_protocol_type));
- DB_ACTION(sqlite3_bind_text(stmt, 8, stat_key->ifname, -1,
- SQLITE_STATIC));
+ DB_ACTION(sqlite3_bind_text(stmt, 8, stat_key->ifname ? stat_key->ifname : "",
+ -1, SQLITE_STATIC));
DB_ACTION(sqlite3_bind_text(stmt, 9,
- stat_key->subscriber_id ? stat_key->subscriber_id : "" , -1,
- SQLITE_STATIC));
+ stat_key->subscriber_id ? stat_key->subscriber_id : "" ,
+ -1, SQLITE_STATIC));
DB_ACTION(sqlite3_bind_int(stmt, 10, (int)stat->ground));
/*we want to reuse tree*/
+ rcv = stat->rcv_count;
+ snd = stat->snd_count;
stat->rcv_count = 0;
stat->snd_count = 0;
if (sqlite3_step(stmt) != SQLITE_DONE) {
goto handle_error; //LCOV_EXCL_LINE
}
- STC_LOGD("App stat recorded [%s]", stat->app_id);
+ if (STC_DEBUG_LOG)
+ STC_LOGD("App stat recorded [\033[0;34m%s\033[0;m] "
+ "rcv[%lld] snd[%lld]", stat->app_id, rcv, snd);
handle_error:
sqlite3_reset(stmt);