apply new smack
[apps/core/preloaded/libslp-memo.git] / include / db.h
1 /*
2 *
3 * Copyright 2012  Samsung Electronics Co., Ltd
4 *
5 * Licensed under the Flora License, Version 1.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *    http://floralicense.org/license/
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 #ifndef __LIBSLP_MEMO_DB_H__
20 #define __LIBSLP_MEMO_DB_H__
21
22 //#include <sqlite3.h> // changed to db-util.h
23 #include "db-util.h"
24 #include "memo-db.h"
25
26 sqlite3* db_init(char *);
27 void db_fini(sqlite3 *);
28
29 int insert_data(sqlite3 *, struct memo_data *);
30 int remove_data(sqlite3 *, int id);
31 int update_data(sqlite3 *, struct memo_data *);
32
33 int get_data(sqlite3 *, int , struct memo_data *);
34 struct memo_data_list* get_all_data_list(sqlite3 *);
35 struct memo_operation_list* get_operation_list(sqlite3 *db, time_t stamp);
36 int get_data_count(sqlite3 *db, int *count);
37
38 int has_id(sqlite3 *, int id);
39 time_t get_modtime(sqlite3 *, int id);
40 int get_indexes(sqlite3 *db, int *aIndex, int len, MEMO_SORT_TYPE sort);
41 int search_data(sqlite3 *db, const char *search_str, int limit, int offset, MEMO_SORT_TYPE sort,
42     memo_data_iterate_cb_t cb, void *user_data);
43 int all_data(sqlite3 *db, memo_data_iterate_cb_t cb, void *user_data);
44
45 #define DBHandle sqlite3
46 //#define VCONFKEY_MEMO_DATA_CHANGE "db/memo/data-change"
47
48 #endif /* __LIBSLP_MEMO_DB_H__ */