MyBooks
authors.hpp
Go to the documentation of this file.
1 #ifndef AUTHORS_HPP
2 #define AUTHORS_HPP
3 
5 #include <QObject>
6 #include <QWidget>
7 #include <QSqlDatabase>
8 
9 #include "globals.hpp"
10 
11 class QSqlField;
12 class QSqlRecord;
13 class QSqlQuery;
14 class QSqlError;
15 class QSqlTableModel;
16 
19 class Authors : public QObject
20 {
21  Q_OBJECT
22  Q_PROPERTY(quint32 err READ getLastErr)
23  Q_PROPERTY(QString errmsg READ getLastErrMsg)
24 
25 public:
45  explicit Authors(QObject *parent=0);
46  virtual ~Authors();
47 
48  quint32 getLastErr() { return err; }
49  QString getLastErrMsg() { return errmsg; }
50 
57  bool depchk(int id);
58 
64  bool save(AuthorsRecord rec);
65 
72  bool del(AuthorsRecord rec);
73 
78  bool update(AuthorsRecord rec);
79 
84  quint32 findLastID();
85 
91 
96  bool findAuthorName(QString strFName, QString strLName);
97 
102  QSqlQuery findAll();
103 
108  QSqlQuery findID(quint32 id);
109 
114  QSqlQuery findAuthor(QString FName, QString strLName);
115 
122  AuthorsRecord getAuthorsRec(QString strLName);
123 
124 private:
136  quint32 err;
137 
149  QString errmsg;
150 
151  QSqlDatabase db;
152 };
153 
154 
155 #endif // AUTHORS_HPP
bool findAuthorName(QString strFName, QString strLName)
Definition: authors.cpp:172
AuthorsRecord getAuthorsRec(QString strLName)
Definition: authors.cpp:288
QSqlQuery findAll()
Definition: authors.cpp:228
QSqlQuery findAuthor(QString FName, QString strLName)
Definition: authors.cpp:201
QString getLastErrMsg()
Definition: authors.hpp:49
Definition: globals.hpp:13
quint32 findLastID()
Definition: authors.cpp:267
QString errmsg
Definition: authors.hpp:23
bool findAuthorsRecord(AuthorsRecord rec)
Definition: authors.cpp:128
QSqlDatabase db
Definition: authors.hpp:151
QSqlQuery findID(quint32 id)
Definition: authors.cpp:247
quint32 err
Definition: authors.hpp:22
quint32 getLastErr()
Definition: authors.hpp:48
bool save(AuthorsRecord rec)
Definition: authors.cpp:69
bool del(AuthorsRecord rec)
Definition: authors.cpp:38
bool depchk(int id)
Definition: authors.cpp:20
bool update(AuthorsRecord rec)
Definition: authors.cpp:99
Definition: authors.hpp:19