KDb

PostgresqlCursor.h
1/* This file is part of the KDE project
2 Copyright (C) 2003 Adam Pigg <adam@piggz.co.uk>
3 Copyright (C) 2010 Jarosław Staniek <staniek@kde.org>
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this program; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KDB_POSTGRESQLCURSOR_H
22#define KDB_POSTGRESQLCURSOR_H
23
24#include "KDbCursor.h"
25#include "KDbField.h"
26
27#include <libpq-fe.h>
28
29class KDbConnection;
30class PostgresqlCursorData;
31
32class PostgresqlCursor: public KDbCursor
33{
34public:
35 explicit PostgresqlCursor(KDbConnection* conn, const KDbEscapedString& sql,
36 KDbCursor::Options options = KDbCursor::Option::None);
37 PostgresqlCursor(KDbConnection* conn, KDbQuerySchema* query,
38 KDbCursor::Options options = KDbCursor::Option::None);
39 ~PostgresqlCursor() override;
40
41 QVariant value(int pos) override;
42 const char** recordData() const override;
43 bool drv_storeCurrentRecord(KDbRecordData* data) const override;
44 bool drv_open(const KDbEscapedString& sql) override;
45 bool drv_close() override;
46 void drv_getNextRecord() override;
47 void drv_appendCurrentRecordToBuffer() override;
48 void drv_bufferMovePointerNext() override;
49 void drv_bufferMovePointerPrev() override;
50 void drv_bufferMovePointerTo(qint64 to) override;
51
52 void storeResultAndClear(PGresult **pgResult, ExecStatusType execStatus);
53
54private:
55 QVariant pValue(int pos)const;
56
57 unsigned long m_numRows;
58 QVector<KDbField::Type> m_realTypes;
59 QVector<int> m_realLengths;
60
61 PostgresqlCursorData * const d;
62 Q_DISABLE_COPY(PostgresqlCursor)
63};
64
65#endif
Provides database connection, allowing queries and data modification.
Provides database cursor functionality.
Definition KDbCursor.h:69
KDbQuerySchema * query() const
Options options() const
Specialized string for escaping.
KDbQuerySchema provides information about database query.
Structure for storing single record with type information.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:11:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.