__STC_LOG_FUNC_EXIT__;
}
handle_error:
- sqlite3_reset(delete_query[4]);
+ if (sqlite3_reset(delete_query[4]) != SQLITE_OK)
+ error_code = STC_ERROR_DB_FAILED;
+
return error_code;
}
//LCOV_EXCL_STOP
STC_LOGD("Entry deleted successfully.");
handle_error:
- sqlite3_reset(stmt);
+ if (sqlite3_reset(stmt) != SQLITE_OK)
+ error_code = STC_ERROR_DB_FAILED;
+
return error_code;
}
bind parameters in the query */
stc_db_tm_interval_s interval;
- memset(&data, 0, sizeof(data));
-
if (!rule || !info_cb) {
__STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
return STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
}
+ memset(&data, 0, sizeof(data));
+
+ if (rule->app_id) {
+ int ret = table_statistics_per_app(rule->app_id, rule, info_cb, user_data);
+ __STC_LOG_FUNC_EXIT__;
+ return ret;
+ }
+
/* pick a statement depending on parameters */
if (rule->granularity) {
stmt = __is_iftype_defined(rule->iftype) ?
} while (rc == SQLITE_ROW);
handle_error:
- sqlite3_reset(stmt);
+ rc = sqlite3_reset(stmt);
+ if (rc != SQLITE_OK)
+ error_code = STC_ERROR_DB_FAILED;
+
__STC_LOG_FUNC_EXIT__;
return error_code;
}
API stc_error_e table_statistics_per_app(const char *app_id,
- table_statistics_select_rule *rule,
+ const table_statistics_select_rule *rule,
table_statistics_info_cb info_cb,
void *user_data)
{
} while (rc == SQLITE_ROW);
handle_error:
- sqlite3_reset(stmt);
+ rc = sqlite3_reset(stmt);
+ if (rc != SQLITE_OK)
+ error_code = STC_ERROR_DB_FAILED;
+
__STC_LOG_FUNC_EXIT__;
return error_code;
}
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_UNKNOWN;
- int64_t rcv;
- int64_t snd;
+ long long int rcv;
+ long long int snd;
if (!stat->rcv_count && !stat->snd_count) {
error_code = STC_ERROR_INVALID_PARAMETER;
"rcv[%lld] snd[%lld]", stat->app_id, rcv, snd);
handle_error:
- sqlite3_reset(stmt);
+ if (sqlite3_reset(stmt) != SQLITE_OK)
+ error_code = STC_ERROR_DB_FAILED;
+
return error_code;
}