+++ /dev/null
-PRAGMA journal_mode = PERSIST;
-
-CREATE TABLE IF NOT EXISTS rua_history (
- id INTEGER PRIMARY KEY,
- pkg_name TEXT,
- app_path TEXT,
- arg TEXT,
- launch_time INTEGER
-);
#define __RUA_SCHEMA_H__
#define CREATE_RUA_HISTORY_TABLE " \
-create table if not exists rua_history ( \
-id INTEGER PRIMARY KEY, \
-pkg_name TEXT, \
-app_path TEXT, \
-arg TEXT, \
-launch_time INTEGER \
+PRAGMA journal_mode = PERSIST; \
+\
+CREATE TABLE IF NOT EXISTS rua_history ( \
+ id INTEGER PRIMARY KEY, \
+ pkg_name TEXT, \
+ app_path TEXT, \
+ arg TEXT, \
+ launch_time INTEGER \
);"
/* table index */
*/
/**
- * @file rua.h
+ * @file rua.h
* @brief RUA API declaration header file.
* @author Jinwoo Nam (jwoo.nam@samsung.com)
* @version 0.1
%install
%make_install
-mkdir -p %{buildroot}%{TZ_SYS_DB}
-sqlite3 %{buildroot}%{TZ_SYS_DB}/.rua.db < data/rua_db.sql
%post -p /sbin/ldconfig
%files
%manifest %{name}.manifest
%defattr(-,root,root,-)
-%config(noreplace) %attr(0660,root,%{TZ_SYS_USER_GROUP}) %{TZ_SYS_DB}/.rua.db*
%{_libdir}/librua.so.*
%license LICENSE
%{_includedir}/rua/*.h
%{_libdir}/librua.so
%{_libdir}/pkgconfig/rua.pc
-
#include <db-util.h>
+/* For multi-user support */
+#include <tzplatform_config.h>
+
#include "rua.h"
#include "db-schema.h"
#include "perf-measure.h"
-#define RUA_DB_PATH "/opt/dbspace"
#define RUA_DB_NAME ".rua.db"
#define RUA_HISTORY "rua_history"
#define QUERY_MAXLEN 4096
}
char defname[FILENAME_MAX];
- snprintf(defname, sizeof(defname), "%s/%s", RUA_DB_PATH, RUA_DB_NAME);
+ const char *rua_db_path = tzplatform_getenv(TZ_USER_DB);
+ snprintf(defname, sizeof(defname), "%s/%s", rua_db_path, RUA_DB_NAME);
_db = __db_init(defname);
if (_db == NULL)
int r;
sqlite3 *db = NULL;
- r = db_util_open(root, &db, 0);
+ r = db_util_open_with_options(root, &db, SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, NULL);
if (r) {
db_util_close(db);
return NULL;
{
int ret = 0;
struct rua_rec rec;
- char apppath[FILENAME_MAX] = "";
+ const char *apppath = tzplatform_mkpath(TZ_SYS_RW_APP, pkgname);
- apppath = tzplatform_mkpath(TZ_SYS_RW_APP, pkgname);
memset(&rec, 0, sizeof(rec));
rec.pkg_name = pkgname;
rec.app_path = apppath;
rua_fini();
return ret;
-
}
int main(int argc, char* argv[])
ret = __add_history(argv[1]);
return 0;
}
-
-