~ubuntu-branches/ubuntu/breezy/koffice/breezy-security

« back to all changes in this revision

Viewing changes to kexi/kexidb/drivers/mySQL/mysqlconnection_p.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-10-11 14:49:50 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051011144950-lwpngbifzp8nk0ds
Tags: 1:1.4.1-0ubuntu7
* SECURITY UPDATE: fix heap based buffer overflow in the RTF importer of KWord
* Opening specially crafted RTF files in KWord can cause
  execution of abitrary code.
* Add kubuntu_01_rtfimport_heap_overflow.diff
* References:
  CAN-2005-2971
  CESA-2005-005
  http://www.koffice.org/security/advisory-20051011-1.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2004 Martin Ellis <m.a.ellis@ncl.ac.uk>
 
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., 59 Temple Place - Suite 330,
 
17
Boston, MA 02111-1307, USA.
 
18
*/
 
19
 
 
20
#ifndef KEXIDB_MYSQLCLIENT_P_H
 
21
#define KEXIDB_MYSQLCLIENT_P_H
 
22
 
 
23
#ifdef Q_WS_WIN
 
24
#include <mysql/config-win.h>
 
25
#endif
 
26
#include <mysql.h>
 
27
 
 
28
typedef struct st_mysql MYSQL;
 
29
 
 
30
class QCString;
 
31
class QString;
 
32
 
 
33
#ifdef MYSQLMIGRATE_H
 
34
#define NAMESPACE KexiMigration
 
35
#else
 
36
#define NAMESPACE KexiDB
 
37
#endif
 
38
 
 
39
namespace NAMESPACE {
 
40
 
 
41
class ConnectionData;
 
42
 
 
43
//! Internal MySQL connection data.
 
44
/*! Provides a low-level API for accessing MySQL databases, that can
 
45
    be shared by any module that needs direct access to the underlying
 
46
    database.  Used by the KexiDB and KexiMigration drivers.
 
47
 */
 
48
class MySqlConnectionInternal
 
49
{
 
50
        public:
 
51
                MySqlConnectionInternal();
 
52
                ~MySqlConnectionInternal();
 
53
                //! Connect to a MySQL database
 
54
                bool db_connect(const KexiDB::ConnectionData& data);
 
55
                //! Disconnect from the database
 
56
                bool db_disconnect();
 
57
 
 
58
                //! Select a database that is about to be used
 
59
                bool useDatabase(const QString &dbName = QString::null);
 
60
                
 
61
                //! Execute SQL statement on the database
 
62
                bool executeSQL( const QString& statement );
 
63
 
 
64
                //! Stores last result's error status
 
65
                void storeError();
 
66
 
 
67
                //! Escape a table, database or column name
 
68
                QString escapeIdentifier(const QString& str) const;
 
69
 
 
70
                MYSQL *mysql;
 
71
                QString errmsg; //<! server-specific message of last operation
 
72
                int res; //<! result code of last operation on server
 
73
};
 
74
 
 
75
 
 
76
//! Internal MySQL cursor data.
 
77
/*! Provides a low-level abstraction for iterating over MySql result sets.
 
78
 */
 
79
 
 
80
class MySqlCursorData : public MySqlConnectionInternal
 
81
{
 
82
        public:
 
83
                MySqlCursorData()
 
84
                : MySqlConnectionInternal()
 
85
                , mysqlres(0)
 
86
                , mysqlrow(0)
 
87
                , lengths(0)
 
88
                , numRows(0)
 
89
                {
 
90
                }
 
91
                ~MySqlCursorData()
 
92
                {
 
93
                }
 
94
 
 
95
                MYSQL_RES *mysqlres;
 
96
                MYSQL_ROW mysqlrow;
 
97
                unsigned long *lengths;
 
98
                unsigned long numRows;
 
99
};
 
100
 
 
101
}
 
102
 
 
103
#endif