KDb

MysqlPreparedStatement.h
1/* This file is part of the KDE project
2 Copyright (C) 2006-2010 Jarosław Staniek <staniek@kde.org>
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KDB_MYSQLPREPAREDSTATEMENT_H
21#define KDB_MYSQLPREPAREDSTATEMENT_H
22
23#include "KDbPreparedStatementInterface.h"
24#include "MysqlConnection_p.h"
25
26//! @todo 3.1 - unfinished: #define KDB_USE_MYSQL_STMT; for 3.0 we're using unoptimized version
27
28/*! Implementation of prepared statements for MySQL driver. */
29class MysqlPreparedStatement : public KDbPreparedStatementInterface, public MysqlConnectionInternal
30{
31public:
32 explicit MysqlPreparedStatement(MysqlConnectionInternal* conn);
33
34 ~MysqlPreparedStatement() override;
35
36private:
37 bool prepare(const KDbEscapedString& sql) override;
38
39 Q_REQUIRED_RESULT QSharedPointer<KDbSqlResult> execute(KDbPreparedStatement::Type type,
40 const KDbField::List &selectFieldList,
41 KDbFieldList *insertFieldList,
42 const KDbPreparedStatementParameters &parameters) override;
43
44 bool init();
45 void done();
46
47#ifdef KDB_USE_MYSQL_STMT
48 bool bindValue(KDbField *field, const QVariant& value, int arg);
49 int m_realParamCount;
50 MYSQL_STMT *m_statement;
51 MYSQL_BIND *m_mysqlBind;
52#endif
53 KDbEscapedString m_tempStatementString;
54 bool m_resetRequired;
55 Q_DISABLE_COPY(MysqlPreparedStatement)
56};
57
58#endif
Specialized string for escaping.
Meta-data for a field.
Definition KDbField.h:72
Prepared statement interface for backend-dependent implementations.
Type
Defines type of the prepared statement.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 12 2024 12:05:27 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.