Version 0.7-0
[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 createProfilesTable();
26     int insertProfile(org::maemo::vicar::Profile profile);
27     bool updateProfile(org::maemo::vicar::Profile profile);
28     bool selectProfile(int id,org::maemo::vicar::Profile* profile);
29     bool getAllProfiles(org::maemo::vicar::ProfileList* profileList);
30     bool findProfileByNumber(QString number,org::maemo::vicar::Profile* profile);
31     bool getDefaultProfile(org::maemo::vicar::Profile* profile);
32     bool deleteProfile(int id);
33     QSqlError lastError();
34
35 private:
36     QSqlDatabase profilesDB;
37 };
38
39 #endif // DATABASEUTILITY_H