4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #ifndef _MEDIA_SVC_DB_UTILS_H_
22 #define _MEDIA_SVC_DB_UTILS_H_
27 #include "media-svc-env.h"
29 #define SQLITE3_FINALIZE(x) if (x != NULL) sqlite3_finalize(x);
30 #define SQLITE3_SAFE_FREE(x) {if (x != NULL) {sqlite3_free(x); x = NULL; } }
32 int _media_svc_make_table_query(const char *table_name, media_svc_table_slist_e list, uid_t uid);
33 int _media_svc_init_table_query(void);
34 void _media_svc_destroy_table_query(void);
35 int _media_svc_sql_query(const char *sql_str, uid_t uid);
36 int _media_svc_sql_query_direct(const char *sql_str, uid_t uid);
37 int _media_svc_check_table_exist(sqlite3 *db_handle, bool *exist);
38 int _media_svc_sql_prepare_to_step(sqlite3 *handle, const char *sql_str, sqlite3_stmt **stmt);
39 int _media_svc_sql_prepare_to_step_simple(sqlite3 *handle, const char *sql_str, sqlite3_stmt **stmt);
40 int _media_svc_sql_query_list(GList **query_list, uid_t uid);
41 int _media_svc_sql_query_list_direct(GList **query_list, uid_t uid);
42 void _media_svc_sql_query_add(GList **query_list, char **query);
43 void _media_svc_sql_query_release(GList **query_list);
45 #endif /*_MEDIA_SVC_DB_UTILS_H_*/