Modify error code for badge API
[platform/core/appfw/badge.git] / include / badge_db.h
1 /*
2  * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18
19 #ifndef __BADGE_DB_DEF_H__
20 #define __BADGE_DB_DEF_H__
21
22 #include <stdbool.h>
23 #include <sqlite3.h>
24 #include <sys/types.h>
25 #include <gio/gio.h>
26 #include <tzplatform_config.h>
27 #include <badge_error.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 #define BADGE_DB_PATH tzplatform_mkpath(TZ_SYS_DB, ".badge.db")
34 #define BADGE_SETTING_DB_TABLE "badge_setting"
35
36 int badge_db_insert(const char *pkgname, const char *writable_pkg, const char *caller, uid_t uid);
37 int badge_db_delete(const char *pkgname, const char *caller_pkg, uid_t uid, pid_t pid);
38 int badge_db_delete_by_pkgname(const char *pkgname, uid_t uid);
39 int badge_db_set_count(const char *pkgname, const char *caller_pkg, unsigned int count, uid_t uid, pid_t pid);
40 int badge_db_get_count(const char *pkgname, unsigned int *count, uid_t uid);
41 int badge_db_set_display_option(const char *pkgname, unsigned int is_display, uid_t uid);
42 int badge_db_get_display_option(const char *pkgname, unsigned int *is_display, uid_t uid);
43 int badge_db_exec(sqlite3 *db, const char *query, int *num_changes);
44 int badge_db_get_list(GList **badge_list, uid_t uid);
45 int badge_db_is_existing(const char *pkgname, bool *existing, uid_t uid);
46 int badge_db_init();
47
48 #ifdef __cplusplus
49         }
50 #endif
51
52 #endif /* __BADGE_DB_DEF_H__ */
53