Remove storage_name from SELECT queries. 29/140929/2 accepted/tizen/unified/20170731.020706 submit/tizen/20170728.071055
authorMinje Ahn <minje.ahn@samsung.com>
Thu, 27 Jul 2017 07:07:34 +0000 (16:07 +0900)
committerhj kim <backto.kim@samsung.com>
Fri, 28 Jul 2017 07:07:12 +0000 (07:07 +0000)
storage_name was exist only in SDCard case. (CID)
but not used anywherer and deprecated.

Change-Id: I6e16dafe1e3a0fec97afa60178176c4b5d6b5898
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
include/media_info_private.h
include_product/media_info_private.h
src/media_db.c
src/media_storage.c

index 5956a7f..3e4cfd8 100755 (executable)
@@ -343,7 +343,6 @@ typedef struct {
 
 typedef struct {
        char *storage_id;
-       char *storage_name;
        char *storage_path;
        int storage_type;
 } media_storage_s;
@@ -657,8 +656,8 @@ typedef struct _media_content_cb_data {
 
 /* Storage*/
 #define SELECT_STORAGE_COUNT                           "SELECT COUNT(*) FROM "DB_TABLE_STORAGE" WHERE validity=1"
-#define SELECT_STORAGE_LIST                                    "SELECT * FROM "DB_TABLE_STORAGE" WHERE validity=1"
-#define SELECT_STORAGE_INFO_FROM_STORAGE       "SELECT * FROM "DB_TABLE_STORAGE" WHERE validity=1 AND storage_uuid='%s'"
+#define SELECT_STORAGE_LIST                                    "SELECT storage_uuid, storage_path, storage_type FROM "DB_TABLE_STORAGE" WHERE validity=1"
+#define SELECT_STORAGE_INFO_FROM_STORAGE       "SELECT storage_uuid, storage_path, storage_type FROM "DB_TABLE_STORAGE" WHERE validity=1 AND storage_uuid='%s'"
 
 /* Face */
 #define DELETE_FACE_FROM_FACE                  "DELETE FROM "DB_TABLE_FACE" WHERE face_uuid='%q'"
index 16e0a03..5e2b8e7 100755 (executable)
@@ -367,7 +367,6 @@ typedef struct {
 
 typedef struct {
        char *storage_id;
-       char *storage_name;
        char *storage_path;
        int storage_type;
 } media_storage_s;
@@ -827,8 +826,8 @@ typedef struct _media_content_scan_cb_data_v2 {
 
 /* Storage*/
 #define SELECT_STORAGE_COUNT                           "SELECT COUNT(*) FROM "DB_TABLE_STORAGE" WHERE validity=1"
-#define SELECT_STORAGE_LIST                                    "SELECT * FROM "DB_TABLE_STORAGE" WHERE validity=1"
-#define SELECT_STORAGE_INFO_FROM_STORAGE       "SELECT * FROM "DB_TABLE_STORAGE" WHERE validity=1 AND storage_uuid='%s'"
+#define SELECT_STORAGE_LIST                                    "SELECT storage_uuid, storage_path, storage_type FROM "DB_TABLE_STORAGE" WHERE validity=1"
+#define SELECT_STORAGE_INFO_FROM_STORAGE       "SELECT storage_uuid, storage_path, storage_type FROM "DB_TABLE_STORAGE" WHERE validity=1 AND storage_uuid='%s'"
 
 /* Face */
 #define DELETE_FACE_FROM_FACE                  "DELETE FROM "DB_TABLE_FACE" WHERE face_uuid='%q'"
index 538f7a3..8bad57f 100755 (executable)
@@ -1513,9 +1513,8 @@ int _media_db_get_storage(filter_h filter, media_storage_cb callback, void *user
                }
 
                _storage->storage_id = g_strdup((const char *)sqlite3_column_text(stmt, 0));
-               _storage->storage_name = g_strdup((const char *)sqlite3_column_text(stmt, 1));
-               _storage->storage_path = g_strdup((const char *)sqlite3_column_text(stmt, 2));
-               _storage->storage_type = (int)sqlite3_column_int(stmt, 3);
+               _storage->storage_path = g_strdup((const char *)sqlite3_column_text(stmt, 1));
+               _storage->storage_type = (int)sqlite3_column_int(stmt, 2);
 
                if (callback((media_storage_h)_storage, user_data) == false) {
                        media_storage_destroy((media_storage_h) _storage);
index af6a907..6320b60 100755 (executable)
 
 #include <media_info_private.h>
 
-static void __media_storage_get_detail(sqlite3_stmt* stmt, media_storage_h storage)
-{
-       media_storage_s *_storage = (media_storage_s*)storage;
-
-       _storage->storage_id = g_strdup((const char *)sqlite3_column_text(stmt, 0));
-       _storage->storage_name = g_strdup((const char *)sqlite3_column_text(stmt, 1));
-       _storage->storage_path = g_strdup((const char *)sqlite3_column_text(stmt, 2));
-       _storage->storage_type = (int)sqlite3_column_int(stmt, 3);
-
-       return;
-}
-
 int media_storage_get_storage_info_from_db(const char *storage_id, media_storage_h *storage)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -55,7 +43,9 @@ int media_storage_get_storage_info_from_db(const char *storage_id, media_storage
                        return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                }
 
-               __media_storage_get_detail(stmt, (media_storage_h)_storage);
+               _storage->storage_id = g_strdup((const char *)sqlite3_column_text(stmt, 0));
+               _storage->storage_path = g_strdup((const char *)sqlite3_column_text(stmt, 1));
+               _storage->storage_type = (int)sqlite3_column_int(stmt, 2);
 
                *storage = (media_storage_h)_storage;
        }
@@ -128,7 +118,6 @@ int media_storage_destroy(media_storage_h storage)
        if (_storage) {
                SAFE_FREE(_storage->storage_id);
                SAFE_FREE(_storage->storage_path);
-               SAFE_FREE(_storage->storage_name);
                SAFE_FREE(_storage);
 
                ret = MEDIA_CONTENT_ERROR_NONE;
@@ -158,15 +147,6 @@ int media_storage_clone(media_storage_h *dst, media_storage_h src)
                        }
                }
 
-               if (STRING_VALID(_src->storage_name)) {
-                       _dst->storage_name = strdup(_src->storage_name);
-                       if (_dst->storage_name == NULL) {
-                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
-                               media_storage_destroy((media_storage_h)_dst);
-                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
-                       }
-               }
-
                if (STRING_VALID(_src->storage_path)) {
                        _dst->storage_path = strdup(_src->storage_path);
                        if (_dst->storage_path == NULL) {
@@ -218,14 +198,7 @@ int media_storage_get_name(media_storage_h storage, char **storage_name)
        media_storage_s *_storage = (media_storage_s*)storage;
 
        if (_storage && storage_name) {
-               if (STRING_VALID(_storage->storage_name)) {
-                       *storage_name = strdup(_storage->storage_name);
-                       media_content_retvm_if(*storage_name == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
-               } else {
-                       *storage_name = NULL;
-               }
-
-               ret = MEDIA_CONTENT_ERROR_NONE;
+               *storage_name = NULL;
        } else {
                media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
                ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;