Multiuser feature
[platform/core/multimedia/libmedia-service.git] / src / include / common / media-svc-db-utils.h
1 /*
2  * libmedia-service
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Hyunjun Ko <zzoon.ko@samsung.com>, Haejeong Kim <backto.kim@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22
23 #ifndef _MEDIA_SVC_DB_UTILS_H_
24 #define _MEDIA_SVC_DB_UTILS_H_
25
26 #include <sqlite3.h>
27 #include <glib.h>
28
29 #define SQLITE3_FINALIZE(x)       if(x  != NULL) {sqlite3_finalize(x);}
30
31 int _media_svc_connect_db_with_handle(sqlite3 **db_handle);
32 int _media_svc_disconnect_db_with_handle(sqlite3 *db_handle);
33 int _media_svc_create_media_table(sqlite3 *db_handle, uid_t uid);
34 int _media_svc_create_folder_table(sqlite3 *db_handle, uid_t uid);
35 int _media_svc_create_playlist_table(sqlite3 *db_handle, uid_t uid);
36 int _media_svc_create_album_table(sqlite3 *db_handle, uid_t uid);
37 int _media_svc_create_tag_table(sqlite3 *db_handle, uid_t uid);
38 int _media_svc_create_bookmark_table(sqlite3 *db_handle, uid_t uid);
39 int _media_svc_create_custom_table(sqlite3 *db_handle, uid_t uid);
40 int _media_svc_request_update_db(const char *sql_str, uid_t uid);
41 int _media_svc_sql_query(sqlite3 *db_handle, const char *sql_str, uid_t uid);
42 int _media_svc_sql_prepare_to_step(sqlite3 *handle, const char *sql_str, sqlite3_stmt** stmt);
43 int _media_svc_sql_begin_trans(sqlite3 *handle, uid_t uid);
44 int _media_svc_sql_end_trans(sqlite3 *handle, uid_t uid);
45 int _media_svc_sql_rollback_trans(sqlite3 *handle, uid_t uid);
46 int _media_svc_sql_query_list(sqlite3 *handle, GList **query_list, uid_t uid);
47 void _media_svc_sql_query_add(GList **query_list, char **query);
48 void _media_svc_sql_query_release(GList **query_list);
49
50 #endif /*_MEDIA_SVC_DB_UTILS_H_*/