Heart 1.3.842.34c2ab5
Heart is base back end library for your c++ Qt projects.
customdbrequest.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018-2024 QuasarApp.
3 * Distributed under the lgplv3 software license, see the accompanying
4 * Everyone is permitted to copy and distribute verbatim copies
5 * of this license document, but changing it is not allowed.
6*/
7
8
9#ifndef CUSTOMDBREQUEST_H
10#define CUSTOMDBREQUEST_H
11#include <QSqlQuery>
12#include <QString>
13#include <dbobject.h>
14
15namespace QH {
16namespace PKG {
17
18template <class BASE>
19
33class CustomDBRequest: public BASE
34{
35public:
40 CustomDBRequest(const QString& selectRequest) {
41 _request = selectRequest;
42 }
43
44 bool isCached() const override {
45 return false;
46 }
47
48 bool isValid() const override {
49 return _request.contains("select", Qt::CaseInsensitive);
50 }
51
52 PrepareResult prepareSelectQuery(QSqlQuery &q) const override {
53 if (!q.prepare(_request)) {
55 }
56
58 }
59
60private:
61 QString _request;
62};
63
64}
65
66}
67
68#endif // CUSTOMDBREQUEST_H
The CustomDBRequest class intended for send to database custom select request for working with multip...
PrepareResult prepareSelectQuery(QSqlQuery &q) const override
bool isValid() const override
bool isCached() const override
CustomDBRequest(const QString &selectRequest)
CustomDBRequest.
PrepareResult
The PrepareResult enum is result of work prepare sql query of dbobjects.
Definition dbobject.h:24
@ Success
prepare finished successful.
@ Fail
prepare is failed.
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition heart.cpp:13