SIGSEGV Fixed
[vicar] / src / vicar-lib / cpp / databaseutility.h
1 /*
2 @version: 0.6
3 @author: Sudheer K. <scifi1947 at gmail.com>
4 @license: GNU General Public License
5 */
6
7 #ifndef DATABASEUTILITY_H
8 #define DATABASEUTILITY_H
9
10 #include <QObject>
11 #include "vicarprofiletypes.h"
12 #include <QSqlError>
13 #include <QSqlDatabase>
14
15 class DatabaseUtility : public QObject
16 {
17     Q_OBJECT
18 public:
19     DatabaseUtility(QObject *parent = 0);
20     ~DatabaseUtility();
21     bool openDatabase();
22     bool deleteDatabase();
23     void closeDatabase();
24     bool tableExists(QString tableName);
25     bool prepareTables();
26     QString getSetting(QString setting);
27     bool setSetting(QString setting, QString value);
28     int insertProfile(org::maemo::vicar::Profile profile);
29     bool updateProfile(org::maemo::vicar::Profile profile);
30     bool selectProfile(int id,org::maemo::vicar::Profile* profile);
31     bool getAllProfiles(org::maemo::vicar::ProfileList* profileList);
32     bool findProfileByNumber(QString number,org::maemo::vicar::Profile* profile);
33     bool getDefaultProfile(org::maemo::vicar::Profile* profile);
34     bool deleteProfile(int id);
35     QSqlError lastError();
36
37 private:
38     QSqlDatabase vicarDB;
39 };
40
41 #endif // DATABASEUTILITY_H