9
0
Fork 0

fix PURGE_MS sqlite3 access

This commit is contained in:
Harald Welte 2016-06-10 17:33:38 +02:00
parent 09ccb6308e
commit f1b793f203
2 changed files with 4 additions and 8 deletions

View File

@ -30,6 +30,8 @@ static const char *stmt_sql[] = {
[UPD_SGSN_BY_ID] = "UPDATE subscriber SET sgsn_number = ? WHERE id = ?",
[AUC_BY_IMSI] = "SELECT id, algo_id_2g, ki, algo_id_3g, k, op, opc, sqn FROM subscriber LEFT JOIN auc_2g ON auc_2g.subscriber_id = subscriber.id LEFT JOIN auc_3g ON auc_3g.subscriber_id = subscriber.id WHERE imsi = ?",
[AUC_UPD_SQN] = "UPDATE auc_3g SET sqn = ? WHERE subscriber_id = ?",
[UPD_PURGE_CS_BY_IMSI] = "UPDATE subscriber SET ms_purged_cs=1 WHERE imsi = ?",
[UPD_PURGE_PS_BY_IMSI] = "UPDATE subscriber SET ms_purged_ps=1 WHERE imsi = ?",
};
static void sql3_error_log_cb(void *arg, int err_code, const char *msg)

View File

@ -146,15 +146,9 @@ int db_subscr_purge(struct db_context *dbc, const char *imsi, bool is_ps)
else
stmt = dbc->stmt[UPD_PURGE_CS_BY_IMSI];
rc = sqlite3_bind_int(stmt, 1, 1);
rc = sqlite3_bind_text(stmt, 1, imsi, -1, SQLITE_STATIC);
if (rc != SQLITE_OK) {
LOGP(DAUC, LOGL_ERROR, "Error binding Purged: %d\n", rc);
return -1;
}
rc = sqlite3_bind_text(stmt, 2, imsi, -1, SQLITE_STATIC);
if (rc != SQLITE_OK) {
LOGP(DAUC, LOGL_ERROR, "Error binding IMSI: %d\n", rc);
LOGP(DAUC, LOGL_ERROR, "Error binding IMSI %s: %d\n", imsi, rc);
ret = -1;
goto out;
}