Sayonara Player
SayonaraQuery.h
1 /* SayonaraQuery.h */
2 
3 /* Copyright (C) 2011-2016 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program 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
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 
23 #ifndef SAYONARAQUERY_H
24 #define SAYONARAQUERY_H
25 
26 #include <QSqlQuery>
27 #include <QString>
28 #include <QVariant>
29 #include <QSqlDatabase>
30 #include <QSqlError>
31 
32 class SayonaraQuery : public QSqlQuery {
33 
34 private:
35  QString _query_string;
36 
37 public:
38  SayonaraQuery(const QString& query=QString(), QSqlDatabase db = QSqlDatabase());
39  SayonaraQuery(QSqlResult * result);
40  SayonaraQuery(QSqlDatabase db);
41  SayonaraQuery(const QSqlQuery & other);
42 
43  virtual ~SayonaraQuery();
44 
45  bool prepare(const QString& query);
46  void bindValue(const QString & placeholder, const QVariant & val, QSql::ParamType paramType = QSql::In);
47  bool exec();
48 
49  QString get_query_string() const;
50  void show_error(const QString& err_msg) const;
51 };
52 
53 
54 #endif // SAYONARAQUERY_H
Definition: SayonaraQuery.h:32