return box_type_dup;
}
-int web_provider_livebox_insert_box_type(
+const char* web_provider_livebox_get_app_id(const char* box_id)
+{
+ if (!box_id) {
+ return NULL;
+ }
+
+ std::shared_ptr<WebProviderDB> handle(new WebProviderDB());
+ if (!handle->openDB()) {
+ return NULL;
+ }
+
+ std::string query = "select * from " + infoTable + " where box_id = ?";
+ if (!handle->setCommand(query, "s", box_id)) {
+ handle->closeDB();
+ return NULL;
+ }
+
+ if (!handle->executeCommand()) {
+ handle->closeDB();
+ return NULL;
+ }
+
+ const char* app_id = handle->getText(1);
+ const char* app_id_dup = NULL;
+
+ if (app_id) {
+ app_id_dup = strdup(app_id);
+ }
+
+ handle->closeDB();
+
+ return app_id_dup;
+}
+
+int web_provider_livebox_get_auto_launch(const char* box_id)
+{
+ if (!box_id) {
+ return NULL;
+ }
+
+ std::shared_ptr<WebProviderDB> handle(new WebProviderDB());
+ if (!handle->openDB()) {
+ return NULL;
+ }
+
+ std::string query = "select * from " + infoTable + " where box_id = ?";
+ if (!handle->setCommand(query, "s", box_id)) {
+ handle->closeDB();
+ return NULL;
+ }
+
+ if (!handle->executeCommand()) {
+ handle->closeDB();
+ return NULL;
+ }
+
+ int autoLaunch = handle->getInt(3);
+ handle->closeDB();
+
+ return autoLaunch;
+}
+
+int web_provider_livebox_insert_box_info(
const char* box_id,
const char* app_id,
- const char* box_type)
+ const char* box_type,
+ int auto_launch)
{
if (!box_id || !app_id || !box_type) {
return -1;
}
std::string query =
- "insert into " + infoTable + " (box_id, app_id, box_type) values (?,?,?)";
+ "insert into " + infoTable +
+ " (box_id, app_id, box_type, auto_launch) values (?,?,?,?)";
- if (!handle->setCommand(query, "sss", box_id, app_id, box_type)) {
+ if (!handle->setCommand(query, "sssi", box_id, app_id, box_type, auto_launch)) {
handle->closeDB();
return -1;
}
return 0;
}
+int web_provider_livebox_insert_box_type(
+ const char* box_id,
+ const char* app_id,
+ const char* box_type)
+{
+ return web_provider_livebox_insert_box_info(box_id, app_id, box_type, 0);
+}
+
int web_provider_livebox_delete_by_box_id(const char* box_id)
{
if (!box_id) {
const char* app_id,
const char* box_type)
{
- return web_provider_livebox_insert_box_type(box_id, app_id, box_type);
+ return web_provider_livebox_insert_box_info(box_id, app_id, box_type, 0);
}
int web_provider_info_delete_by_box_id(const char* box_id)