ret = sqlite3_open_v2(path, &db, SQLITE_OPEN_READWRITE, NULL);
if (ret != SQLITE_OK) {
LOGE("sqlite3_open_v2() is failed. error(%d)", ret);
- if (db)
- sqlite3_close_v2(db);
+ sqlite3_close_v2(db);
return NULL;
}
return NULL;
}
+ ret = sqlite3_exec(db, "PRAGMA foreign_keys=ON", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ LOGE("Failed to enable foreign key support. error(%s)",
+ sqlite3_errmsg(db));
+ sqlite3_close_v2(db);
+ return NULL;
+ }
+
return db;
}
GList *locales)
{
static const char query[] =
- "INSERT OR REPLACE INTO component_localized_info "
+ "INSERT INTO component_localized_info "
"(component_id, component_locale, component_label, "
"component_icon) VALUES (?, ?, ?, ?)";
sqlite3_stmt *stmt = NULL;
int component_plugin_parser_db_insert(component_t *component)
{
static const char query[] =
- "INSERT OR REPLACE INTO component_info "
+ "INSERT INTO component_info "
"(package, app_id, component_id, component_type, "
"component_launch_mode, component_main, "
"component_icon_display, component_taskmanage) "