~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to kexi/migration/mdb/src/keximdb/mdbmigrate.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2005,2006 Martin Ellis <martin.ellis@kdemail.net>
 
3
   Copyright (C) 2005 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 MDBMIGRATE_H
 
22
#define MDBMIGRATE_H
 
23
 
 
24
#include <mdbtools.h>
 
25
 
 
26
#include <migration/keximigrate.h>
 
27
#include <migration/keximigrate_p.h>
 
28
#include <kexidb/field.h>
 
29
#include <kexidb/connection.h>
 
30
#include <QByteArray>
 
31
 
 
32
namespace KexiMigration
 
33
{
 
34
 
 
35
class MDBMigrate : public KexiMigrate
 
36
{
 
37
    Q_OBJECT
 
38
    KEXIMIGRATION_DRIVER
 
39
 
 
40
public:
 
41
    MDBMigrate(QObject *parent, const QVariantList& args = QVariantList());
 
42
    virtual ~MDBMigrate();
 
43
 
 
44
    //! Convert an MDB type to a KexiDB type, prompting user if necessary.
 
45
    KexiDB::Field::Type type(int type);
 
46
 
 
47
    //! Get the table definition for a given table name
 
48
    /*! Look up the table definition for the given table.  This only returns a ptr
 
49
        to the MdbTableDef - it doesn't load e.g. the column data.
 
50
        Remember to mdb_free_tabledef the table definition when it's finished
 
51
        with.
 
52
        \return the table definition, or null if no matching table was found
 
53
    */
 
54
    MdbTableDef* getTableDef(const QString& tableName);
 
55
 
 
56
    QVariant toQVariant(const char* data, unsigned int len, int type);
 
57
 
 
58
    bool getPrimaryKey(KexiDB::TableSchema* table, MdbTableDef* tableDef);
 
59
 
 
60
    //! Reimplemented to add support for "sourceDatabaseHasNonUnicodeEncoding" property
 
61
    //! @todo this should be in Connection class but Migration framework has no such yet!
 
62
    virtual QVariant propertyValue(const QByteArray& propName);
 
63
 
 
64
protected:
 
65
    //! Driver specific function to return table names
 
66
    virtual bool drv_tableNames(QStringList& tablenames);
 
67
 
 
68
    //! Driver specific implementation to read a table schema
 
69
    virtual bool drv_readTableSchema(
 
70
        const QString& originalName, KexiDB::TableSchema& tableSchema);
 
71
 
 
72
    //! Driver specific connection implementation
 
73
    virtual bool drv_connect();
 
74
 
 
75
    //! Disconnect from the db backend
 
76
    virtual bool drv_disconnect();
 
77
 
 
78
    /*! Copy MDB table to KexiDB database */
 
79
    virtual bool drv_copyTable(const QString& srcTable,
 
80
                               KexiDB::Connection *destConn, KexiDB::TableSchema* dstTable);
 
81
 
 
82
    virtual bool drv_progressSupported() {
 
83
        return true;
 
84
    }
 
85
    virtual bool drv_getTableSize(const QString& table, qulonglong& size);
 
86
 
 
87
private:
 
88
    void initBackend();
 
89
    void releaseBackend();
 
90
    MdbHandle *m_mdb;
 
91
};
 
92
}
 
93
 
 
94
#endif