* | whitelist_id | provider_id | consumer_id |
* +------------+---------------+-------------+
*
+ * sticker_recent_history_info
+ * +------------+-----------------+-------+-----------+
+ * | INT | INT | INT | TEXT |
+ * +------------+-----------------+-------+-----------+
+ * | history_id | sticker_info_id | count | timestamp |
+ * +------------+-----------------+-------+-----------+
+ *
*/
#define STICKER_DB_PATH tzplatform_mkpath(TZ_SYS_DB, ".sticker_info.db")
#define STICKER_INFO_CREATE_TABLE "CREATE TABLE IF NOT EXISTS sticker_info(sticker_info_id INTEGER PRIMARY KEY AUTOINCREMENT, app_id TEXT NOT NULL, type INTEGER NOT NULL, uri TEXT NOT NULL, thumbnail TEXT, description TEXT, group_name TEXT NOT NULL, date TEXT NOT NULL, display_type INTEGER)"
#define STICKER_KEYWORD_INFO_CREATE_TABLE "CREATE TABLE IF NOT EXISTS sticker_keyword_info(keyword_id INTEGER PRIMARY KEY AUTOINCREMENT, sticker_info_id INTEGER, keyword TEXT NOT NULL, FOREIGN KEY (sticker_info_id) REFERENCES sticker_info(sticker_info_id) ON DELETE CASCADE)"
#define STICKER_WHITELIST_INFO_CREATE_TABLE "CREATE TABLE IF NOT EXISTS sticker_whitelist_info(whitelist_id INTEGER PRIMARY KEY AUTOINCREMENT, provider_id TEXT NOT NULL, consumer_id TEXT NOT NULL)"
+#define STICKER_RECENT_HISTORY_INFO_CREATE_TABLE "CREATE TABLE IF NOT EXISTS sticker_recent_history_info(history_id INTEGER PRIMARY KEY AUTOINCREMENT, sticker_info_id INTEGER, count INTEGER NOT NULL, timestamp TEXT NOT NULL, FOREIGN KEY (sticker_info_id) REFERENCES sticker_info(sticker_info_id) ON DELETE CASCADE)"
#define STICKER_DB_INSERT_STICKER_INFO "INSERT INTO sticker_info (app_id, type, uri, thumbnail, description, group_name, date, display_type) VALUES (?, ?, ?, ?, ?, ?, DateTime('now','localtime'), ?)"
#define STICKER_DB_INSERT_STICKER_KEYWORD_INFO "INSERT INTO sticker_keyword_info (sticker_info_id, keyword) VALUES (?, ?)"
ret = STICKERD_SERVER_ERROR_DB_FAILED;
}
+ ret = sqlite3_exec(db, STICKER_RECENT_HISTORY_INFO_CREATE_TABLE, NULL, NULL, &err);
+ if (ret != SQLITE_OK) {
+ LOGE("Failed to create sticker_recent_history_info table : %s", err);
+ ret = STICKERD_SERVER_ERROR_DB_FAILED;
+ }
+
is_corrupted = FALSE;
cleanup:
goto cleanup;
}
+ ret = sqlite3_exec(db, STICKER_RECENT_HISTORY_INFO_CREATE_TABLE, NULL, NULL, &err);
+ if (ret != SQLITE_OK) {
+ LOGE("Failed to create sticker_recent_history_info table : %s", err);
+ ret = STICKERD_SERVER_ERROR_DB_FAILED;
+ goto cleanup;
+ }
+
ret = sqlite3_exec(db, "PRAGMA journal_mode = WAL", NULL, NULL, &err);
if (ret != SQLITE_OK) {
LOGE("Failed to set journal_mode : %s", err);
#define STICKER_INFO_CREATE_TABLE "CREATE TABLE IF NOT EXISTS sticker_info(sticker_info_id INTEGER PRIMARY KEY AUTOINCREMENT, app_id TEXT NOT NULL, type INTEGER NOT NULL, uri TEXT NOT NULL, thumbnail TEXT, description TEXT, group_name TEXT NOT NULL, date TEXT NOT NULL, display_type INTEGER)"
#define STICKER_KEYWORD_INFO_CREATE_TABLE "CREATE TABLE IF NOT EXISTS sticker_keyword_info(keyword_id INTEGER PRIMARY KEY AUTOINCREMENT, sticker_info_id INTEGER, keyword TEXT NOT NULL, FOREIGN KEY (sticker_info_id) REFERENCES sticker_info(sticker_info_id) ON DELETE CASCADE)"
#define STICKER_WHITELIST_INFO_CREATE_TABLE "CREATE TABLE IF NOT EXISTS sticker_whitelist_info(whitelist_id INTEGER PRIMARY KEY AUTOINCREMENT, provider_id TEXT NOT NULL, consumer_id TEXT NOT NULL)"
+#define STICKER_RECENT_HISTORY_INFO_CREATE_TABLE "CREATE TABLE IF NOT EXISTS sticker_recent_history_info(history_id INTEGER PRIMARY KEY AUTOINCREMENT, sticker_info_id INTEGER, count INTEGER NOT NULL, timestamp TEXT NOT NULL, FOREIGN KEY (sticker_info_id) REFERENCES sticker_info(sticker_info_id) ON DELETE CASCADE)"
#define UIFW_ID 502
#define APPFW_ID 301
#define MAX_ERROR_BUFFER 256
goto cleanup;
}
+ ret = sqlite3_exec(db, STICKER_RECENT_HISTORY_INFO_CREATE_TABLE, NULL, NULL, &err);
+ if (ret != SQLITE_OK) {
+ LOGE("Failed to create sticker_recent_history_info table : %s", err);
+ goto cleanup;
+ }
+
is_corrupted = FALSE;
cleanup:
goto cleanup;
}
+ ret = sqlite3_exec(db, STICKER_RECENT_HISTORY_INFO_CREATE_TABLE, NULL, NULL, &err);
+ if (ret != SQLITE_OK) {
+ LOGE("Failed to create sticker_recent_history_info table : %s", err);
+ goto cleanup;
+ }
+
ret = sqlite3_exec(db, "PRAGMA journal_mode = WAL", NULL, NULL, &err);
if (ret != SQLITE_OK) {
LOGE("Failed to set journal_mode : %s", err);