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 static inline void __sqlfree(void *p)
31 void **pp = (void **)p;
34 #define sql_autoptr __attribute__((cleanup(__sqlfree))) char *
36 int _media_svc_create_table(uid_t uid);
37 int _media_svc_sql_query(const char *sql_str, uid_t uid);
38 int _media_svc_sql_query_direct(const char *sql_str, uid_t uid);
39 int _media_svc_check_table_exist(sqlite3 *db_handle, bool *exist);
40 int _media_svc_get_result_with_check_record(sqlite3 *handle, const char *sql_str, sqlite3_stmt **stmt);
41 int _media_svc_get_result(sqlite3 *handle, const char *sql_str, sqlite3_stmt **stmt);
42 int _media_svc_sql_query_list(GList **query_list, uid_t uid);
43 int _media_svc_sql_query_list_direct(GList **query_list, uid_t uid);
45 #endif /*_MEDIA_SVC_DB_UTILS_H_*/