diff options
author | Sangyoon Jang <s89.jang@samsung.com> | 2015-12-17 11:11:03 +0900 |
---|---|---|
committer | Sangyoon Jang <s89.jang@samsung.com> | 2015-12-17 11:12:25 +0900 |
commit | 611e60eef993d63c747c7ef516e9cf5c9ee010d2 (patch) | |
tree | f16e9a9a5f85ede24f07735e1d42c178e774b04c | |
parent | 58afbbd710eabd7fe1d081a8c235d5e43a22ee1c (diff) | |
download | widget-service-611e60eef993d63c747c7ef516e9cf5c9ee010d2.tar.gz widget-service-611e60eef993d63c747c7ef516e9cf5c9ee010d2.tar.bz2 widget-service-611e60eef993d63c747c7ef516e9cf5c9ee010d2.zip |
Enable foreign key when open dbsubmit/tizen_common/20151229.154718submit/tizen_common/20151229.144031submit/tizen/20151217.070232accepted/tizen/wearable/20151217.223601accepted/tizen/tv/20151217.223546accepted/tizen/mobile/20151217.223531
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.sql | 3 | ||||
-rw-r--r-- | parser/widget_plugin_parser_internal.c | 7 |
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; |