Remove bundle insert
[platform/core/multimedia/libmedia-service.git] / src / include / common / media-svc-env.h
1 /*
2  * libmedia-service
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20
21
22 #ifndef _MEDIA_SVC_ENV_H_
23 #define _MEDIA_SVC_ENV_H_
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 /**
30  * DB table information
31  */
32
33 /**
34  * Table Name
35  */
36 #define DB_TABLE_MEDIA "media"          /**< media table*/
37 #define DB_TABLE_FOLDER "folder"                /**< media_folder table*/
38 #define DB_TABLE_PLAYLIST "playlist"    /**< playlist table*/
39 #define DB_TABLE_PLAYLIST_MAP "playlist_map"    /**< playlist_map table*/
40 #define DB_TABLE_ALBUM "album"          /**< album table*/
41 #define DB_TABLE_TAG "tag"              /**< tag table*/
42 #define DB_TABLE_TAG_MAP "tag_map"      /**< tag_map table*/
43 #define DB_TABLE_BOOKMARK "bookmark"    /**< bookmark table*/
44 #define DB_TABLE_STORAGE "storage"      /**< storage table*/
45 #define DB_TABLE_FACE "face"            /**< face table*/
46 #define DB_TABLE_FACE_SCAN_LIST "face_scan_list"        /**< face_scan_list table*/
47
48 /**
49  * View Name
50  */
51 #define DB_VIEW_PLAYLIST "playlist_view"        /**< playlist_view*/
52 #define DB_VIEW_TAG "tag_view"          /**< tag_view*/
53
54 /**
55  * Trigger Name
56  */
57 #define DB_TRIGGER_PLAYLIST_MAP "playlist_map_cleanup"          /**< media to map*/
58 #define DB_TRIGGER_PLAYLIST_MAP1 "playlist_map_cleanup_1"       /**< playlist to map*/
59 #define DB_TRIGGER_ALBUM "album_cleanup"
60 #define DB_TRIGGER_TAG_MAP "tag_map_cleanup"            /**< media to map*/
61 #define DB_TRIGGER_TAG_MAP1 "tag_map_cleanup_1"         /**< tag to map*/
62 #define DB_TRIGGER_BOOKMARK "bookmark_cleanup"
63 #define DB_TRIGGER_FACE_SCAN_LIST "face_scan_list_cleanup"
64 #define DB_TRIGGER_FACE "face_cleanup"
65
66 /**
67  * Column Name for view
68  */
69 #define DB_COLUMN_THUMBNAIL "thumbnail_path"
70 #define DB_COLUMN_MAP_ID "_id"
71
72
73 /**
74  * option
75  */
76 #define DB_TYPE_TEXT "TEXT"
77 #define DB_TYPE_INT "INTEGER"
78 #define DB_TYPE_DOUBLE "DOUBLE"
79
80 /**
81  * Query form
82  */
83 #define DB_QUERY_TABLE_WITH_UNIQUE "CREATE TABLE IF NOT EXISTS '%s' (%s, unique(%s));"
84 #define DB_QUERY_TABLE "CREATE TABLE IF NOT EXISTS '%s' (%s);"
85 #define DB_QUERY_TRIGGER "CREATE TRIGGER IF NOT EXISTS '%s' DELETE ON '%s' BEGIN DELETE FROM %s WHERE %s=old.%s;END;"
86 #define DB_QUERY_TRIGGER_WITH_COUNT "CREATE TRIGGER IF NOT EXISTS '%s' DELETE ON '%s' BEGIN DELETE FROM %s WHERE (SELECT count(*) FROM '%s' WHERE %s=old.%s)=1 AND %s=old.%s;END;"
87 #define DB_QUERY_VIEW_PLAYLIST "CREATE VIEW IF NOT EXISTS %s AS SELECT %s FROM playlist \
88                         LEFT OUTER JOIN playlist_map ON playlist.playlist_id = playlist_map.playlist_id \
89                         LEFT OUTER JOIN media ON (playlist_map.media_id = media.media_id AND media.validity=1) \
90                         LEFT OUTER JOIN (SELECT count(playlist_id) as playlist_media_count, playlist_id FROM playlist_map group by playlist_id) as cnt_tbl ON (cnt_tbl.playlist_id=playlist_map.playlist_id AND media.validity=1);"
91 #define DB_QUERY_VIEW_TAG "CREATE VIEW IF NOT EXISTS %s AS SELECT %s FROM tag \
92                         LEFT OUTER JOIN tag_map ON tag.tag_id=tag_map.tag_id \
93                         LEFT OUTER JOIN media ON (tag_map.media_id = media.media_id AND media.validity=1) \
94                         LEFT OUTER JOIN (SELECT count(tag_id) as tag_media_count, tag_id FROM tag_map group by tag_id) as cnt_tbl ON (cnt_tbl.tag_id=tag_map.tag_id AND media.validity=1);"
95
96
97 #define MEDIA_SVC_METADATA_LEN_MAX 512          /**< Length of metadata*/
98 #define MEDIA_SVC_PATHNAME_SIZE 4096            /**< Length of Path name. */
99 #define MEDIA_SVC_UUID_SIZE 36          /**< Length of UUID*/
100
101 #define MEDIA_SVC_TAG_UNKNOWN ""
102
103 typedef enum {
104         MEDIA_SVC_QUERY_SCANNER,
105         MEDIA_SVC_QUERY_UPDATE_COMMON,
106 } media_svc_query_type_e;
107
108 typedef enum {
109         DB_LIST_MEDIA = 0,
110         DB_LIST_FOLDER,
111         DB_LIST_PLAYLIST_MAP,
112         DB_LIST_PLAYLIST,
113         DB_LIST_ALBUM,
114         DB_LIST_TAG_MAP,
115         DB_LIST_TAG,
116         DB_LIST_BOOKMARK,
117         DB_LIST_STORAGE,
118         DB_LIST_FACE_SCAN_LIST,
119         DB_LIST_FACE,
120         DB_LIST_MAX,
121 } media_svc_table_slist_e;
122
123 #ifdef __cplusplus
124 }
125 #endif
126
127 #endif /*_MEDIA_SVC_ENV_H_*/