sqliteformat.h
Go to the documentation of this file.
1/*
2 This file is part of the mkcal library.
3
4 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
5 Contact: Alvaro Manera <alvaro.manera@nokia.com>
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
21*/
31#ifndef MKCAL_SQLITEFORMAT_H
32#define MKCAL_SQLITEFORMAT_H
33
34#include "mkcal_export.h"
35#include "extendedstorage.h"
36#include "notebook.h"
37
38#include <KCalendarCore/Incidence>
39
40#include <sqlite3.h>
41
42#include <QTimeZone>
43
44namespace mKCal {
45
55{
56public:
60 enum RDateType {
61 RDate = 1,
64 XDateTime
65 };
66
71 AllowEvents = (1 << 0),
72 AllowJournals = (1 << 1),
73 AllowTodos = (1 << 2),
74 Shared = (1 << 3),
75 Master = (1 << 4),
76 Synchronized = (1 << 5),
77 ReadOnly = (1 << 6),
78 Visible = (1 << 7),
79 RunTimeOnly = (1 << 8),
80 Default = (1 << 9),
81 Shareable = (1 << 10)
82 };
83
87 SqliteFormat(sqlite3 *database, const QTimeZone &timeZone = {});
88
92 virtual ~SqliteFormat();
93
103 bool modifyCalendars(const Notebook::Ptr &notebook, DBOperation dbop, sqlite3_stmt *stmt, bool isDefault);
104
112 Notebook::Ptr selectCalendars(sqlite3_stmt *stmt, bool *isDefault);
113
122 bool modifyComponents(const KCalendarCore::Incidence::Ptr &incidence, const QString &notebook,
123 DBOperation dbop);
124
125 bool purgeDeletedComponents(const KCalendarCore::Incidence::Ptr &incidence);
126
134 KCalendarCore::Incidence::Ptr selectComponents(sqlite3_stmt *stmt1, QString &notebook);
135
141 KCalendarCore::Person::List selectContacts();
142
143 bool selectMetadata(int *id);
144 bool incrementTransactionId(int *id);
145
146 // Helper Functions //
147
154 sqlite3_int64 toOriginTime(const QDateTime &dt);
155
162 sqlite3_int64 toLocalOriginTime(const QDateTime &dt);
163
169 QDateTime fromLocalOriginTime(sqlite3_int64 seconds);
170
176 QDateTime fromOriginTime(sqlite3_int64 seconds);
177
184 QDateTime fromOriginTime(sqlite3_int64 seconds, const QByteArray &zonename);
185
186private:
187 //@cond PRIVATE
188 Q_DISABLE_COPY(SqliteFormat)
189 class MKCAL_HIDE Private;
190 Private *const d;
191 //@endcond
192};
193
194}
195
196#define SL3_exec( db ) \
197{ \
198 /* kDebug() << "SQL query:" << query; */ \
199 rv = sqlite3_exec( (db), query, NULL, 0, &errmsg ); \
200 if ( rv ) { \
201 if ( rv != SQLITE_CONSTRAINT ) { \
202 qCWarning(lcMkcal) << "sqlite3_exec error code:" << rv; \
203 } \
204 if ( errmsg ) { \
205 if ( rv != SQLITE_CONSTRAINT ) { \
206 qCWarning(lcMkcal) << errmsg; \
207 } \
208 sqlite3_free( errmsg ); \
209 errmsg = NULL; \
210 } \
211 if ( rv != SQLITE_CONSTRAINT ) { \
212 goto error; \
213 } \
214 } \
215}
216
217#define SL3_prepare_v2( db, query, qsize, stmt, tail ) \
218{ \
219 /* kDebug() << "SQL query:" << query; */ \
220 rv = sqlite3_prepare_v2( (db), (query), (qsize), (stmt), (tail) ); \
221 if ( rv ) { \
222 qCWarning(lcMkcal) << "sqlite3_prepare error code:" << rv; \
223 qCWarning(lcMkcal) << sqlite3_errmsg( (db) ); \
224 goto error; \
225 } \
226}
227
228#define SL3_bind_text( stmt, index, value, size, desc ) \
229{ \
230 rv = sqlite3_bind_text( (stmt), (index), (value), (size), (desc) ); \
231 if ( rv ) { \
232 qCWarning(lcMkcal) << "sqlite3_bind_text error:" << rv << "on index and value:" << index << value; \
233 goto error; \
234 } \
235 index++; \
236}
237
238#define SL3_bind_blob( stmt, index, value, size, desc ) \
239{ \
240 rv = sqlite3_bind_blob( (stmt), (index), (value), (size), (desc) ); \
241 if ( rv ) { \
242 qCWarning(lcMkcal) << "sqlite3_bind_blob error:" << rv << "on index and value:" << index << value; \
243 goto error; \
244 } \
245 index++; \
246}
247
248#define SL3_bind_int( stmt, index, value ) \
249{ \
250 rv = sqlite3_bind_int( (stmt), (index), (value) ); \
251 if ( rv ) { \
252 qCWarning(lcMkcal) << "sqlite3_bind_int error:" << rv << "on index and value:" << index << value; \
253 goto error; \
254 } \
255 index++; \
256}
257
258#define SL3_bind_int64( stmt, index, value ) \
259{ \
260 rv = sqlite3_bind_int64( (stmt), (index), (value) ); \
261 if ( rv ) { \
262 qCWarning(lcMkcal) << "sqlite3_bind_int64 error:" << rv << "on index and value:" << index << value; \
263 goto error; \
264 } \
265 index++; \
266}
267
268#define SL3_bind_double( stmt, index, value ) \
269{ \
270 rv = sqlite3_bind_double( (stmt), (index), (value) ); \
271 if ( rv ) { \
272 qCWarning(lcMkcal) << "sqlite3_bind_int error:" << rv << "on index and value:" << index << value; \
273 goto error; \
274 } \
275 index++; \
276}
277
278#define SL3_step( stmt ) \
279{ \
280 rv = sqlite3_step( (stmt) ); \
281 if ( rv && rv != SQLITE_DONE && rv != SQLITE_ROW ) { \
282 if ( rv != SQLITE_CONSTRAINT ) { \
283 qCWarning(lcMkcal) << "sqlite3_step error:" << rv; \
284 } \
285 goto error; \
286 } \
287}
288
289#define SL3_reset( stmt ) \
290{ \
291 rv = sqlite3_reset( (stmt) ); \
292 if ( rv && rv != SQLITE_OK ) { \
293 qCWarning(lcMkcal) << "sqlite3_reset error:" << rv; \
294 goto error; \
295 } \
296}
297
298#define CREATE_METADATA \
299 "CREATE TABLE IF NOT EXISTS Metadata(transactionId INTEGER)"
300#define CREATE_TIMEZONES \
301 "CREATE TABLE IF NOT EXISTS Timezones(TzId INTEGER PRIMARY KEY, ICalData TEXT)"
302#define CREATE_CALENDARS \
303 "CREATE TABLE IF NOT EXISTS Calendars(CalendarId TEXT PRIMARY KEY, Name TEXT, Description TEXT, Color INTEGER, Flags INTEGER, syncDate INTEGER, pluginName TEXT, account TEXT, attachmentSize INTEGER, modifiedDate INTEGER, sharedWith TEXT, syncProfile TEXT, createdDate INTEGER, extra1 STRING, extra2 STRING)"
304
305//Extra fields added for future use in case they are needed. They will be documented here
306//So we can add something without breaking the schema and not adding tables
307//extra1: used to store the color of a single component.
308
309#define CREATE_COMPONENTS \
310 "CREATE TABLE IF NOT EXISTS Components(ComponentId INTEGER PRIMARY KEY AUTOINCREMENT, Notebook TEXT, Type TEXT, Summary TEXT, Category TEXT, DateStart INTEGER, DateStartLocal INTEGER, StartTimeZone TEXT, HasDueDate INTEGER, DateEndDue INTEGER, DateEndDueLocal INTEGER, EndDueTimeZone TEXT, Duration INTEGER, Classification INTEGER, Location TEXT, Description TEXT, Status INTEGER, GeoLatitude REAL, GeoLongitude REAL, Priority INTEGER, Resources TEXT, DateCreated INTEGER, DateStamp INTEGER, DateLastModified INTEGER, Sequence INTEGER, Comments TEXT, Attachments TEXT, Contact TEXT, InvitationStatus INTEGER, RecurId INTEGER, RecurIdLocal INTEGER, RecurIdTimeZone TEXT, RelatedTo TEXT, URL TEXT, UID TEXT, Transparency INTEGER, LocalOnly INTEGER, Percent INTEGER, DateCompleted INTEGER, DateCompletedLocal INTEGER, CompletedTimeZone TEXT, DateDeleted INTEGER, extra1 STRING, extra2 STRING, extra3 INTEGER)"
311
312//Extra fields added for future use in case they are needed. They will be documented here
313//So we can add something without breaking the schema and not adding tables
314
315#define CREATE_RDATES \
316 "CREATE TABLE IF NOT EXISTS Rdates(ComponentId INTEGER, Type INTEGER, Date INTEGER, DateLocal INTEGER, TimeZone TEXT)"
317#define CREATE_CUSTOMPROPERTIES \
318 "CREATE TABLE IF NOT EXISTS Customproperties(ComponentId INTEGER, Name TEXT, Value TEXT, Parameters TEXT)"
319#define CREATE_RECURSIVE \
320 "CREATE TABLE IF NOT EXISTS Recursive(ComponentId INTEGER, RuleType INTEGER, Frequency INTEGER, Until INTEGER, UntilLocal INTEGER, untilTimeZone TEXT, Count INTEGER, Interval INTEGER, BySecond TEXT, ByMinute TEXT, ByHour TEXT, ByDay TEXT, ByDayPos Text, ByMonthDay TEXT, ByYearDay TEXT, ByWeekNum TEXT, ByMonth TEXT, BySetPos TEXT, WeekStart INTEGER)"
321#define CREATE_ALARM \
322 "CREATE TABLE IF NOT EXISTS Alarm(ComponentId INTEGER, Action INTEGER, Repeat INTEGER, Duration INTEGER, Offset INTEGER, Relation TEXT, DateTrigger INTEGER, DateTriggerLocal INTEGER, triggerTimeZone TEXT, Description TEXT, Attachment TEXT, Summary TEXT, Address TEXT, CustomProperties TEXT, isEnabled INTEGER)"
323#define CREATE_ATTENDEE \
324"CREATE TABLE IF NOT EXISTS Attendee(ComponentId INTEGER, Email TEXT, Name TEXT, IsOrganizer INTEGER, Role INTEGER, PartStat INTEGER, Rsvp INTEGER, DelegatedTo TEXT, DelegatedFrom TEXT)"
325#define CREATE_ATTACHMENTS \
326"CREATE TABLE IF NOT EXISTS Attachments(ComponentId INTEGER, Data BLOB, Uri TEXT, MimeType TEXT, ShowInLine INTEGER, Label TEXT, Local INTEGER)"
327#define CREATE_CALENDARPROPERTIES \
328 "CREATE TABLE IF NOT EXISTS Calendarproperties(CalendarId REFERENCES Calendars(CalendarId) ON DELETE CASCADE, Name TEXT NOT NULL, Value TEXT, UNIQUE (CalendarId, Name))"
329
330#define INDEX_CALENDAR \
331"CREATE INDEX IF NOT EXISTS IDX_CALENDAR on Calendars(CalendarId)"
332#define INDEX_COMPONENT \
333"CREATE INDEX IF NOT EXISTS IDX_COMPONENT on Components(ComponentId, Notebook, DateStart, DateEndDue, DateDeleted)"
334#define INDEX_COMPONENT_UID \
335"CREATE UNIQUE INDEX IF NOT EXISTS IDX_COMPONENT_UID on Components(UID, RecurId, DateDeleted)"
336#define INDEX_COMPONENT_NOTEBOOK \
337"CREATE INDEX IF NOT EXISTS IDX_COMPONENT_NOTEBOOK on Components(Notebook)"
338#define INDEX_RDATES \
339"CREATE INDEX IF NOT EXISTS IDX_RDATES on Rdates(ComponentId)"
340#define INDEX_CUSTOMPROPERTIES \
341"CREATE INDEX IF NOT EXISTS IDX_CUSTOMPROPERTIES on Customproperties(ComponentId)"
342#define INDEX_RECURSIVE \
343"CREATE INDEX IF NOT EXISTS IDX_RECURSIVE on Recursive(ComponentId)"
344#define INDEX_ALARM \
345"CREATE INDEX IF NOT EXISTS IDX_ALARM on Alarm(ComponentId)"
346#define INDEX_ATTENDEE \
347"CREATE UNIQUE INDEX IF NOT EXISTS IDX_ATTENDEE on Attendee(ComponentId, Email)"
348#define INDEX_ATTACHMENTS \
349"CREATE INDEX IF NOT EXISTS IDX_ATTACHMENTS on Attachments(ComponentId)"
350#define INDEX_CALENDARPROPERTIES \
351"CREATE INDEX IF NOT EXISTS IDX_CALENDARPROPERTIES on Calendarproperties(CalendarId)"
352
353#define INSERT_TIMEZONES \
354"insert into Timezones values (1, '')"
355#define INSERT_CALENDARS \
356"insert into Calendars values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '', '')"
357#define INSERT_COMPONENTS \
358"insert into Components values (NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?, '', 0)"
359#define INSERT_CUSTOMPROPERTIES \
360"insert into Customproperties values (?, ?, ?, ?)"
361#define INSERT_CALENDARPROPERTIES \
362"insert into Calendarproperties values (?, ?, ?)"
363#define INSERT_RDATES \
364"insert into Rdates values (?, ?, ?, ?, ?)"
365#define INSERT_RECURSIVE \
366"insert into Recursive values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
367#define INSERT_ALARM \
368"insert into Alarm values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
369#define INSERT_ATTENDEE \
370"insert into Attendee values (?, ?, ?, ?, ?, ?, ?, ?, ?)"
371#define INSERT_ATTACHMENTS \
372"insert into Attachments values (?, ?, ?, ?, ?, ?, ?)"
373
374#define UPDATE_METADATA \
375"replace into Metadata (rowid, transactionId) values (1, ?)"
376#define UPDATE_TIMEZONES \
377"update Timezones set ICalData=? where TzId=1"
378#define UPDATE_CALENDARS \
379"update Calendars set Name=?, Description=?, Color=?, Flags=?, syncDate=?, pluginName=?, account=?, attachmentSize=?, modifiedDate=?, sharedWith=?, syncProfile=?, createdDate=? where CalendarId=?"
380#define UPDATE_COMPONENTS \
381"update Components set Notebook=?, Type=?, Summary=?, Category=?, DateStart=?, DateStartLocal=?, StartTimeZone=?, HasDueDate=?, DateEndDue=?, DateEndDueLocal=?, EndDueTimeZone=?, Duration=?, Classification=?, Location=?, Description=?, Status=?, GeoLatitude=?, GeoLongitude=?, Priority=?, Resources=?, DateCreated=?, DateStamp=?, DateLastModified=?, Sequence=?, Comments=?, Attachments=?, Contact=?, RecurId=?, RecurIdLocal=?, RecurIdTimeZone=?, RelatedTo=?, URL=?, UID=?, Transparency=?, LocalOnly=?, Percent=?, DateCompleted=?, DateCompletedLocal=?, CompletedTimeZone=?, extra1=? where ComponentId=?"
382#define UPDATE_COMPONENTS_AS_DELETED \
383"update Components set DateDeleted=? where ComponentId=?"
384//"update Components set DateDeleted=strftime('%s','now') where ComponentId=?"
385
386#define DELETE_CALENDARS \
387"delete from Calendars where CalendarId=?"
388#define DELETE_COMPONENTS \
389"delete from Components where ComponentId=?"
390#define DELETE_RDATES \
391"delete from Rdates where ComponentId=?"
392#define DELETE_CUSTOMPROPERTIES \
393"delete from Customproperties where ComponentId=?"
394#define DELETE_CALENDARPROPERTIES \
395"delete from Calendarproperties where CalendarId=?"
396#define DELETE_RECURSIVE \
397"delete from Recursive where ComponentId=?"
398#define DELETE_ALARM \
399"delete from Alarm where ComponentId=?"
400#define DELETE_ATTENDEE \
401"delete from Attendee where ComponentId=?"
402#define DELETE_ATTACHMENTS \
403"delete from Attachments where ComponentId=?"
404
405#define SELECT_METADATA \
406"select * from Metadata where rowid=1"
407#define SELECT_TIMEZONES \
408"select * from Timezones where TzId=1"
409#define SELECT_CALENDARS_ALL \
410"select * from Calendars order by Name"
411#define SELECT_COMPONENTS_ALL \
412"select * from Components where DateDeleted=0"
413#define SELECT_COMPONENTS_BY_NOTEBOOK \
414"select * from Components where Notebook=? and DateDeleted=0"
415#define SELECT_COMPONENTS_ALL_DELETED \
416"select * from Components where DateDeleted<>0"
417#define SELECT_COMPONENTS_ALL_DELETED_BY_NOTEBOOK \
418"select * from Components where Notebook=? and DateDeleted<>0"
419#define SELECT_COMPONENTS_BY_GEO \
420"select * from Components where GeoLatitude!=255.0 and GeoLongitude!=255.0 and DateDeleted=0"
421#define SELECT_COMPONENTS_BY_GEO_AREA \
422"select * from Components where GeoLatitude>=? and GeoLongitude>=? and GeoLatitude<=? and GeoLongitude<=? and DateDeleted=0"
423#define SELECT_COMPONENTS_BY_JOURNAL \
424"select * from Components where Type='Journal' and DateDeleted=0"
425#define SELECT_COMPONENTS_BY_JOURNAL_DATE \
426"select * from Components where Type='Journal' and DateDeleted=0 and datestart<=? order by DateStart desc, DateCreated desc"
427#define SELECT_COMPONENTS_BY_PLAIN \
428"select * from Components where DateStart=0 and DateEndDue=0 and DateDeleted=0"
429#define SELECT_COMPONENTS_BY_RECURSIVE \
430"select * from Components where ((ComponentId in (select DISTINCT ComponentId from Recursive)) or (ComponentId in (select DISTINCT ComponentId from Rdates)) or (RecurId!=0)) and DateDeleted=0"
431#define SELECT_COMPONENTS_BY_ATTENDEE \
432"select * from Components where ComponentId in (select DISTINCT ComponentId from Attendee) and DateDeleted=0"
433#define SELECT_COMPONENTS_BY_DATE_BOTH \
434"select * from Components where DateStart<? and (DateEndDue>=? or (DateEndDue=0 and DateStart>=?)) and DateDeleted=0"
435#define SELECT_COMPONENTS_BY_DATE_START \
436"select * from Components where (DateEndDue>=? or (DateEndDue=0 and DateStart>=?)) and DateDeleted=0"
437#define SELECT_COMPONENTS_BY_DATE_END \
438"select * from Components where DateStart<? and DateDeleted=0"
439#define SELECT_COMPONENTS_BY_UID_AND_RECURID \
440"select * from Components where UID=? and RecurId=? and DateDeleted=0"
441#define SELECT_COMPONENTS_BY_UID \
442"select * from Components where UID=? and DateDeleted=0"
443#define SELECT_COMPONENTS_BY_NOTEBOOKUID \
444"select * from Components where Notebook=? and DateDeleted=0"
445#define SELECT_ROWID_FROM_COMPONENTS_BY_UID_AND_RECURID \
446"select ComponentId from Components where UID=? and RecurId=? and DateDeleted=0"
447#define SELECT_COMPONENTS_BY_UNCOMPLETED_TODOS \
448"select * from Components where Type='Todo' and DateCompleted=0 and DateDeleted=0"
449#define SELECT_COMPONENTS_BY_COMPLETED_TODOS_AND_DATE \
450"select * from Components where Type='Todo' and DateCompleted<>0 and DateEndDue<>0 and DateEndDue<=? and DateDeleted=0 order by DateEndDue desc, DateCreated desc"
451#define SELECT_COMPONENTS_BY_COMPLETED_TODOS_AND_CREATED \
452"select * from Components where Type='Todo' and DateCompleted<>0 and DateEndDue=0 and DateCreated<=? and DateDeleted=0 order by DateCreated desc"
453#define SELECT_COMPONENTS_BY_DATE_SMART \
454"select * from Components where DateEndDue<>0 and DateEndDue<=? and DateDeleted=0 order by DateEndDue desc, DateCreated desc"
455
456#define FUTURE_DATE_SMART_FIELD \
457" (case type when 'Todo' then DateEndDue else DateStart end) "
458#define SELECT_COMPONENTS_BY_FUTURE_DATE_SMART \
459 "select * from Components where " \
460 FUTURE_DATE_SMART_FIELD ">=? and DateDeleted=0 order by " \
461 FUTURE_DATE_SMART_FIELD " asc, DateCreated asc"
462
463#define SELECT_COMPONENTS_BY_CREATED_SMART \
464"select * from Components where DateEndDue=0 and DateCreated<=? and DateDeleted=0 order by DateCreated desc"
465#define SELECT_COMPONENTS_BY_GEO_AND_DATE \
466"select * from Components where GeoLatitude!=255.0 and GeoLongitude!=255.0 and DateEndDue<>0 and DateEndDue<=? and DateDeleted=0 order by DateEndDue desc, DateCreated desc"
467#define SELECT_COMPONENTS_BY_GEO_AND_CREATED \
468"select * from Components where GeoLatitude!=255.0 and GeoLongitude!=255.0 and DateEndDue=0 and DateCreated<=? and DateDeleted=0 order by DateCreated desc"
469#define SELECT_COMPONENTS_BY_ATTENDEE_EMAIL_AND_CREATED \
470"select * from Components where ComponentId in (select distinct ComponentId from Attendee where email=?) and DateCreated<=? and DateDeleted=0 order by DateCreated desc"
471#define SELECT_COMPONENTS_BY_ATTENDEE_AND_CREATED \
472"select * from Components where ComponentId in (select distinct ComponentId from Attendee) and DateCreated<=? and DateDeleted=0 order by DateCreated desc"
473#define SELECT_RDATES_BY_ID \
474"select * from Rdates where ComponentId=?"
475#define SELECT_CUSTOMPROPERTIES_BY_ID \
476"select * from Customproperties where ComponentId=?"
477#define SELECT_RECURSIVE_BY_ID \
478"select * from Recursive where ComponentId=?"
479#define SELECT_ALARM_BY_ID \
480"select * from Alarm where ComponentId=?"
481#define SELECT_ATTENDEE_BY_ID \
482"select * from Attendee where ComponentId=?"
483#define SELECT_ATTACHMENTS_BY_ID \
484"select * from Attachments where ComponentId=?"
485#define SELECT_CALENDARPROPERTIES_BY_ID \
486"select * from Calendarproperties where CalendarId=?"
487#define SELECT_COMPONENTS_BY_DUPLICATE \
488"select * from Components where DateStart=? and Summary=? and DateDeleted=0"
489#define SELECT_COMPONENTS_BY_DUPLICATE_AND_NOTEBOOK \
490"select * from Components where DateStart=? and Summary=? and Notebook=? and DateDeleted=0"
491#define SELECT_COMPONENTS_BY_CREATED \
492"select * from Components where DateCreated>=? and DateDeleted=0"
493#define SELECT_COMPONENTS_BY_CREATED_AND_NOTEBOOK \
494"select * from Components where DateCreated>=? and Notebook=? and DateDeleted=0"
495#define SELECT_COMPONENTS_BY_LAST_MODIFIED \
496"select * from Components where DateLastModified>=? and DateCreated<? and DateDeleted=0"
497#define SELECT_COMPONENTS_BY_LAST_MODIFIED_AND_NOTEBOOK \
498"select * from Components where DateLastModified>=? and DateCreated<? and Notebook=? and DateDeleted=0"
499#define SELECT_COMPONENTS_BY_DELETED \
500"select * from Components where DateDeleted>=? and DateCreated<?"
501#define SELECT_COMPONENTS_BY_DELETED_AND_NOTEBOOK \
502"select * from Components where DateDeleted>=? and DateCreated<? and Notebook=?"
503#define SELECT_COMPONENTS_BY_UID_RECID_AND_DELETED \
504"select ComponentId, DateDeleted from Components where UID=? and RecurId=? and DateDeleted<>0"
505#define SELECT_ATTENDEE_AND_COUNT \
506"select Email, Name, count(Email) from Attendee where Email<>0 group by Email"
507#define SELECT_EVENT_COUNT \
508"select count(*) from Components where Type='Event' and DateDeleted=0"
509#define SELECT_TODO_COUNT \
510"select count(*) from Components where Type='Todo' and DateDeleted=0"
511#define SELECT_JOURNAL_COUNT \
512"select count(*) from Components where Type='Journal' and DateDeleted=0"
513
514#define UNSET_FLAG_FROM_CALENDAR \
515"update Calendars set Flags=(Flags & (~?))"
516
517#define BEGIN_TRANSACTION \
518"BEGIN IMMEDIATE;"
519#define COMMIT_TRANSACTION \
520"END;"
521
522#endif
Sqlite format implementation.
Definition sqliteformat.h:55
QDateTime fromLocalOriginTime(sqlite3_int64 seconds)
Convert seconds from the origin to clock time.
QDateTime fromOriginTime(sqlite3_int64 seconds)
Convert seconds from the origin to UTC datetime.
QDateTime fromOriginTime(sqlite3_int64 seconds, const QByteArray &zonename)
Convert seconds from the origin to datetime in given timezone.
sqlite3_int64 toOriginTime(const QDateTime &dt)
Convert datetime to seconds relative to the origin.
CalendarFlag
Values stored in the flag column of the calendars table.
Definition sqliteformat.h:70
KCalendarCore::Person::List selectContacts()
Select contacts and order them by appearances.
sqlite3_int64 toLocalOriginTime(const QDateTime &dt)
Convert local datetime to seconds relative to the origin.
RDateType
The different types of rdates.
Definition sqliteformat.h:60
@ XDate
Definition sqliteformat.h:62
@ RDateTime
Definition sqliteformat.h:63
This file is part of the API for handling calendar data and defines the ExtendedStorage interface.
#define MKCAL_EXPORT
Definition mkcal_export.h:27
#define MKCAL_HIDE
Definition mkcal_export.h:31
Definition extendedstorage.h:49
This file is part of the API for handling calendar data and defines the Notebook class.

Generated on Sat Oct 7 2023 19:21:53 for libextendedkcal by doxygen 1.10.0