From: Yunchan Cho Date: Fri, 26 Apr 2013 01:54:07 +0000 (+0900) Subject: Extend C APIs for inserting and reading 'fast-open' attribute X-Git-Tag: submit/tizen_2.2/20130927.092158^2~136 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=28826cdc781e6afcc06d205aeac4d8afbb1bde5b;p=platform%2Fframework%2Fweb%2Fweb-provider.git Extend C APIs for inserting and reading 'fast-open' attribute [Issue#] N/A [Problem] There is no C APIs that can be used for inserting value 'fast-open' to web-provider DB, and reading its value from the DB. [Cause] 'fast-open' attribute of is newly added for support of fast opening PD by web-provider [Solution] For this, existing API regarding insert to DB is extended and new API for reading the value is added Change-Id: I9cadd7f35a1f6b1ee99613695c52a76a6ffd9182 --- diff --git a/data/web_provider_db.sql b/data/web_provider_db.sql index a304108..df1a0c5 100644 --- a/data/web_provider_db.sql +++ b/data/web_provider_db.sql @@ -5,6 +5,7 @@ CREATE TABLE LiveboxInfo ( box_type TEXT not null, auto_launch INT, mouse_event INT, + pd_fast_open INT, PRIMARY KEY (box_id) , CHECK(1) ); COMMIT; diff --git a/src/API/web_provider_livebox_info.cpp b/src/API/web_provider_livebox_info.cpp index 25fbace..84a2549 100644 --- a/src/API/web_provider_livebox_info.cpp +++ b/src/API/web_provider_livebox_info.cpp @@ -30,6 +30,7 @@ enum InfoTableField { BOX_TYPE, AUTO_LAUNCH, MOUSE_EVENT, + PD_FAST_OPEN, }; // TODO this default type should be retrieved more automatically @@ -164,12 +165,41 @@ int web_provider_livebox_get_mouse_event(const char* box_id) return mouseEvent; } +int web_provider_livebox_get_pd_fast_open(const char* box_id) +{ + if (!box_id) { + return NULL; + } + + std::shared_ptr 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 pdFastOpen = handle->getInt(InfoTableField::PD_FAST_OPEN); + handle->closeDB(); + + return pdFastOpen; +} + int web_provider_livebox_insert_box_info( const char* box_id, const char* app_id, const char* box_type, int auto_launch, - int mouse_event) + int mouse_event, + int pd_fast_open) { if (!box_id || !app_id || !box_type) { return -1; @@ -182,11 +212,12 @@ int web_provider_livebox_insert_box_info( std::string query = "insert into " + infoTable + - " (box_id, app_id, box_type, auto_launch, mouse_event) values (?,?,?,?,?)"; + " (box_id, app_id, box_type, auto_launch, mouse_event, pd_fast_open) \ + values (?,?,?,?,?,?)"; if (!handle->setCommand( - query, "sssii", - box_id, app_id, box_type, auto_launch, mouse_event)) { + query, "sssiii", + box_id, app_id, box_type, auto_launch, mouse_event, pd_fast_open)) { handle->closeDB(); return -1; } @@ -205,7 +236,7 @@ int web_provider_livebox_insert_box_type( const char* app_id, const char* box_type) { - return web_provider_livebox_insert_box_info(box_id, app_id, box_type, 0, 0); + return web_provider_livebox_insert_box_info(box_id, app_id, box_type, 0, 0, 0); } int web_provider_livebox_delete_by_box_id(const char* box_id) @@ -307,7 +338,7 @@ int web_provider_info_insert_box_type( const char* app_id, const char* box_type) { - return web_provider_livebox_insert_box_info(box_id, app_id, box_type, 0, 0); + return web_provider_livebox_insert_box_info(box_id, app_id, box_type, 0, 0, 0); } int web_provider_info_delete_by_box_id(const char* box_id) diff --git a/src/API/web_provider_livebox_info.h b/src/API/web_provider_livebox_info.h index b7c03d0..8f55d21 100644 --- a/src/API/web_provider_livebox_info.h +++ b/src/API/web_provider_livebox_info.h @@ -34,12 +34,14 @@ EXPORT_API const char* web_provider_livebox_get_box_type(const char* box_id); EXPORT_API const char* web_provider_livebox_get_app_id(const char* box_id); EXPORT_API int web_provider_livebox_get_auto_launch(const char* box_id); EXPORT_API int web_provider_livebox_get_mouse_event(const char* box_id); +EXPORT_API int web_provider_livebox_get_pd_fast_open(const char* box_id); EXPORT_API int web_provider_livebox_insert_box_info( const char* box_id, const char* app_id, const char* box_type, int auto_launch, - int mouse_event); + int mouse_event, + int pd_fast_open); DEPRECATED_API int web_provider_livebox_insert_box_type( const char* box_id, const char* app_id,