summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/db-schema.h2
-rw-r--r--src/rua.c10
-rw-r--r--src/rua_internal.c6
3 files changed, 12 insertions, 6 deletions
diff --git a/src/db-schema.h b/src/db-schema.h
index 97724b7..090a441 100644
--- a/src/db-schema.h
+++ b/src/db-schema.h
@@ -25,12 +25,12 @@ CREATE TABLE IF NOT EXISTS rua_history ( \
app_path TEXT, \
arg TEXT, \
launch_time INTEGER, \
- comp_id TEXT, \
instance_id TEXT, \
instance_name TEXT, \
icon TEXT, \
uri TEXT, \
image TEXT, \
+ comp_id TEXT, \
PRIMARY KEY(pkg_name, comp_id, instance_id) \
);"
diff --git a/src/rua.c b/src/rua.c
index a3f24c5..9e3ddef 100644
--- a/src/rua.c
+++ b/src/rua.c
@@ -134,8 +134,8 @@ API int rua_clear_history(void)
API int rua_history_load_db_for_uid(char ***table, int *nrows, int *ncols, uid_t uid)
{
static const char query[] =
- "SELECT pkg_name, app_path, arg, launch_time, comp_id,"
- " instance_id, instance_name, icon, uri, image "
+ "SELECT pkg_name, app_path, arg, launch_time,"
+ " instance_id, instance_name, icon, uri, image, comp_id "
"FROM rua_history ORDER BY launch_time DESC";
int r;
char *db_err = NULL;
@@ -283,6 +283,12 @@ API int rua_history_get_rec(struct rua_rec *rec, char **table, int nrows, int nc
else
rec->image = NULL;
+ tmp = db_result[RUA_COL_COMP_ID];
+ if (tmp && tmp[0] != '\0')
+ rec->comp_id = tmp;
+ else
+ rec->comp_id = NULL;
+
return 0;
}
diff --git a/src/rua_internal.c b/src/rua_internal.c
index 8f4cf98..0bb4305 100644
--- a/src/rua_internal.c
+++ b/src/rua_internal.c
@@ -217,8 +217,8 @@ static int __insert_history(sqlite3 *db, struct rua_rec *rec)
static const char query[] =
"INSERT OR REPLACE INTO rua_history ("
" pkg_name, app_path, arg, launch_time,"
- " comp_id, instance_id, instance_name, icon, uri,"
- " image) "
+ " instance_id, instance_name, icon, uri,"
+ " image, comp_id) "
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
int r;
sqlite3_stmt *stmt;
@@ -234,13 +234,13 @@ static int __insert_history(sqlite3 *db, struct rua_rec *rec)
__BIND_TEXT(db, stmt, idx++, rec->app_path);
__BIND_TEXT(db, stmt, idx++, rec->arg ? rec->arg : "");
__BIND_INT(db, stmt, idx++, (int)rec->launch_time);
- __BIND_TEXT(db, stmt, idx++, rec->comp_id ? rec->comp_id : "");
__BIND_TEXT(db, stmt, idx++, rec->instance_id ? rec->instance_id : "");
__BIND_TEXT(db, stmt, idx++,
rec->instance_name ? rec->instance_name : "");
__BIND_TEXT(db, stmt, idx++, rec->icon ? rec->icon : "");
__BIND_TEXT(db, stmt, idx++, rec->uri ? rec->uri : "");
__BIND_TEXT(db, stmt, idx++, rec->image ? rec->image : "");
+ __BIND_TEXT(db, stmt, idx++, rec->comp_id ? rec->comp_id : "");
r = sqlite3_step(stmt);
if (r != SQLITE_DONE) {