summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangyoon Jang <s89.jang@samsung.com>2015-12-17 11:11:03 +0900
committerSangyoon Jang <s89.jang@samsung.com>2015-12-17 11:12:25 +0900
commit611e60eef993d63c747c7ef516e9cf5c9ee010d2 (patch)
treef16e9a9a5f85ede24f07735e1d42c178e774b04c
parent58afbbd710eabd7fe1d081a8c235d5e43a22ee1c (diff)
downloadwidget-service-611e60eef993d63c747c7ef516e9cf5c9ee010d2.tar.gz
widget-service-611e60eef993d63c747c7ef516e9cf5c9ee010d2.tar.bz2
widget-service-611e60eef993d63c747c7ef516e9cf5c9ee010d2.zip
we need to enable foreign key feature when open db fix db creation sql statement(use pragma user_version) Change-Id: I285ebd8d2322639d47e7ffdac5d554cbc7bc5366 Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
-rw-r--r--parser/widget.sql3
-rw-r--r--parser/widget_plugin_parser_internal.c7
2 files changed, 8 insertions, 2 deletions
diff --git a/parser/widget.sql b/parser/widget.sql
index 6984494..d51fc9b 100644
--- a/parser/widget.sql
+++ b/parser/widget.sql
@@ -1,5 +1,4 @@
-PRAGMA tizen_version = 30; /* Tizen 3.0 */
-PRAGMA db_version = 1;
+PRAGMA user_version = 30; /* Tizen 3.0 */
PRAGMA journal_mode = PERSIST;
PRAGMA foreign_keys = ON;
diff --git a/parser/widget_plugin_parser_internal.c b/parser/widget_plugin_parser_internal.c
index ddc5239..1a811e8 100644
--- a/parser/widget_plugin_parser_internal.c
+++ b/parser/widget_plugin_parser_internal.c
@@ -126,6 +126,13 @@ sqlite3 *_open_db(uid_t uid, bool readonly)
return NULL;
}
+ /* turn on foreign keys */
+ if (sqlite3_exec(db, "PRAGMA foreign_keys = ON", NULL, NULL, NULL)) {
+ free(path);
+ sqlite3_close_v2(db);
+ return NULL;
+ }
+
free(path);
return db;