-
Notifications
You must be signed in to change notification settings - Fork 4
/
sqliteformat.h
137 lines (107 loc) · 3.67 KB
/
sqliteformat.h
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
This file is part of the mkcal library.
Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
Contact: Alvaro Manera <alvaro.manera@nokia.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/**
@file
This file is part of the API for handling calendar data and
defines the SqliteFormat class.
@author Tero Aho \<ext-tero.1.aho@nokia.com\>
@author Pertti Luukko \<ext-pertti.luukko@nokia.com\>
*/
#ifndef MKCAL_SQLITEFORMAT_H
#define MKCAL_SQLITEFORMAT_H
#include "mkcal_export.h"
#include "extendedstorage.h"
#include "notebook.h"
#include <KCalendarCore/Incidence>
#include <sqlite3.h>
namespace mKCal {
class SqliteStorage;
/**
@brief
Sqlite format implementation.
This class implements the Sqlite format. It provides methods for
loading/saving/converting Sqlite format data into the internal
representation as Calendar and Incidences.
*/
class MKCAL_EXPORT SqliteFormat
{
public:
/**
The different types of rdates.
*/
enum RDateType {
RDate = 1,
XDate,
RDateTime,
XDateTime
};
/**
Constructor a new Sqlite Format object.
*/
SqliteFormat(SqliteStorage *storage, sqlite3 *database);
/**
Destructor.
*/
virtual ~SqliteFormat();
/**
Update notebook data in Calendars table.
@param notebook notebook to update
@param dbop database operation
@param stmt prepared sqlite statement for calendars table
@return true if the operation was successful; false otherwise.
*/
bool modifyCalendars(const Notebook::Ptr ¬ebook, DBOperation dbop, sqlite3_stmt *stmt);
/**
Select notebooks from Calendars table.
@param stmt prepared sqlite statement for calendars table
@return the queried notebook.
*/
Notebook::Ptr selectCalendars(sqlite3_stmt *stmt);
/**
Update incidence data in Components table.
@param incidence incidence to update
@param notebook notebook of incidence
@param dbop database operation
@return true if the operation was successful; false otherwise.
*/
bool modifyComponents(const KCalendarCore::Incidence::Ptr &incidence, const QString ¬ebook,
DBOperation dbop);
bool purgeDeletedComponents(const KCalendarCore::Incidence::Ptr &incidence);
/**
Select incidences from Components table.
@param stmt1 prepared sqlite statement for components table
@param notebook notebook of incidence
@return the queried incidence.
*/
KCalendarCore::Incidence::Ptr selectComponents(sqlite3_stmt *stmt1, QString ¬ebook);
/**
Select contacts and order them by appearances.
@return ordered list of contacts.
*/
KCalendarCore::Person::List selectContacts();
bool selectMetadata(int *id);
bool incrementTransactionId(int *id);
private:
//@cond PRIVATE
Q_DISABLE_COPY(SqliteFormat)
class MKCAL_HIDE Private;
Private *const d;
//@endcond
};
}
#endif