summaryrefslogtreecommitdiff
path: root/src/libtracker-data/tracker-db-interface-sqlite.h
blob: 18c0204505710c1fc797010144020e97c736843a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 * Copyright (C) 2008, Nokia <ivan.frade@nokia.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 */

#ifndef __LIBTRACKER_DB_INTERFACE_SQLITE_H__
#define __LIBTRACKER_DB_INTERFACE_SQLITE_H__

#include "config.h"

#include "tracker-db-interface.h"

G_BEGIN_DECLS

#if !defined (__LIBTRACKER_DATA_INSIDE__) && !defined (TRACKER_COMPILATION)
#error "only <libtracker-data/tracker-data.h> must be included directly."
#endif

#define TRACKER_COLLATION_NAME "TRACKER"

typedef void (*TrackerDBWalCallback) (gint n_pages);

TrackerDBInterface *tracker_db_interface_sqlite_new                    (const gchar              *filename,
                                                                        GError                  **error);
TrackerDBInterface *tracker_db_interface_sqlite_new_ro                 (const gchar              *filename,
                                                                        GError                  **error);
gint64              tracker_db_interface_sqlite_get_last_insert_id     (TrackerDBInterface       *interface);
void                tracker_db_interface_sqlite_enable_shared_cache    (void);
void                tracker_db_interface_sqlite_fts_init               (TrackerDBInterface       *interface,
                                                                        GHashTable               *properties,
                                                                        GHashTable               *multivalued,
                                                                        gboolean                  create);
void                tracker_db_interface_sqlite_reset_collator         (TrackerDBInterface       *interface);
void                tracker_db_interface_sqlite_wal_hook               (TrackerDBInterface       *interface,
                                                                        TrackerDBWalCallback      callback);

#if HAVE_TRACKER_FTS
void                tracker_db_interface_sqlite_fts_alter_table        (TrackerDBInterface       *interface,
                                                                        GHashTable               *properties,
                                                                        GHashTable               *multivalued);
int                 tracker_db_interface_sqlite_fts_update_text        (TrackerDBInterface       *interface,
                                                                        int                       id,
                                                                        const gchar             **properties,
                                                                        const gchar             **text,
                                                                        gboolean                  create);

gboolean            tracker_db_interface_sqlite_fts_delete_text        (TrackerDBInterface       *db_interface,
									int                       id,
									const gchar              *property);
gboolean            tracker_db_interface_sqlite_fts_delete_id          (TrackerDBInterface       *interface,
                                                                        int                       id);
void                tracker_db_interface_sqlite_fts_update_commit      (TrackerDBInterface       *interface);
void                tracker_db_interface_sqlite_fts_update_rollback    (TrackerDBInterface       *interface);

void                tracker_db_interface_sqlite_fts_rebuild_tokens     (TrackerDBInterface       *interface);

#endif

G_END_DECLS

#endif /* __LIBTRACKER_DB_INTERFACE_SQLITE_H__ */