kexi

KexiMigration::KexiMigrate Class Reference

#include <keximigrate.h>

Inheritance diagram for KexiMigration::KexiMigrate:

KexiDB::Object KexiMigration::MySQLMigrate KexiMigration::PqxxMigrate KexiMigration::TxtMigrate List of all members.

Detailed Description

Imports non-native databases into Kexi projects.

A generic API for importing schema and data from an existing database into a new Kexi project. Can be also used for importing native Kexi databases.

Basic idea is this:

  1. User selects an existing DB and new project (file or server based)
  2. User specifies whether to import structure and data or structure only.
  3. Import tool connects to db
  4. Checks if it is already a kexi project (not implemented yet)
  5. If not, then read structure and construct new project
  6. Ask user what to do if column type is not supported

See kexi/doc/dev/kexi_import.txt for more info.

Definition at line 76 of file keximigrate.h.


Signals

void progressPercent (int percent)

Public Member Functions

virtual ~KexiMigrate ()
KexiMigration::Datadata () const
void setData (KexiMigration::Data *migrateData)
bool checkIfDestinationDatabaseOverwritingNeedsAccepting (Kexi::ObjectStatus *result, bool &acceptingNeeded)
bool isSourceAndDestinationDataSourceTheSame () const
bool performImport (Kexi::ObjectStatus *result=0)
bool performExport (Kexi::ObjectStatus *result=0)
bool progressSupported ()
virtual int versionMajor () const=0
virtual int versionMinor () const=0
virtual QVariant propertyValue (const QCString &propName)
void setPropertyValue (const QCString &propName, const QVariant &value)
QString propertyCaption (const QCString &propName) const
QValueList< QCString > propertyNames () const
virtual bool isValid ()

Protected Member Functions

 KexiMigrate (QObject *parent, const char *name, const QStringList &args=QStringList())
virtual bool drv_connect ()=0
virtual bool drv_disconnect ()=0
virtual bool drv_tableNames (QStringList &tablenames)=0
virtual bool drv_readTableSchema (const QString &originalName, KexiDB::TableSchema &tableSchema)=0
virtual bool drv_copyTable (const QString &srcTable, KexiDB::Connection *destConn, KexiDB::TableSchema *dstTable)=0
virtual bool drv_progressSupported ()
virtual bool drv_getTableSize (const QString &, Q_ULLONG &)
void updateProgress (Q_ULLONG step=1ULL)
KexiDB::Field::Type userType (const QString &fname)

Protected Attributes

KexiMigration::Datam_migrateData
QMap< QCString, QVariant > m_properties
QMap< QCString, QString > m_propertyCaptions

Friends

class MigrateManager

Constructor & Destructor Documentation

KexiMigrate::KexiMigrate ( QObject *  parent,
const char *  name,
const QStringList &  args = QStringList() 
) [protected]

Used by MigrateManager.

Definition at line 36 of file keximigrate.cpp.


Member Function Documentation

KexiMigration::Data* KexiMigration::KexiMigrate::data (  )  const [inline]

Todo:
Remove this! KexiMigrate should be usable for multiple concurrent migrations!

Definition at line 84 of file keximigrate.h.

void KexiMigrate::setData ( KexiMigration::Data migrateData  ) 

Data Setup. Requires two connection objects, a name and a bool.

Todo:
Remove this! KexiMigrate should be usable for multiple concurrent migrations!

Definition at line 52 of file keximigrate.cpp.

bool KexiMigrate::checkIfDestinationDatabaseOverwritingNeedsAccepting ( Kexi::ObjectStatus result,
bool &  acceptingNeeded 
)

Checks whether the destination database exists. For file-based dest. projects, we've already asked about overwriting existing project but for server-based projects it's better to ask user. This method should be called before performImport() or performExport().

Returns:
true if no connection-related errors occured. acceptingNeeded is set to true if destination database exists. In this case you should ask about accepting database overwriting. Used in ImportWizard::import().

Definition at line 64 of file keximigrate.cpp.

bool KexiMigrate::isSourceAndDestinationDataSourceTheSame (  )  const

Checks if the source- and the destination databases are identical.

Returns:
true if they are identical else false.

Definition at line 99 of file keximigrate.cpp.

bool KexiMigrate::performImport ( Kexi::ObjectStatus result = 0  ) 

Perform an import operation.

Todo:
what if these two tables are not compatible with tables created in detination db because newer db format was used?

Todo:
copy kexi__db contents!

Copy every row not being of a type 'table'

Todo:
this is not portable to non-SQL target engines!

Definition at line 116 of file keximigrate.cpp.

bool KexiMigrate::performExport ( Kexi::ObjectStatus result = 0  ) 

Perform an export operation.

Todo:
performExport

Definition at line 324 of file keximigrate.cpp.

bool KexiMigration::KexiMigrate::progressSupported (  )  [inline]

Returns true if the migration driver supports progress updates.

Definition at line 113 of file keximigrate.h.

QVariant KexiMigrate::propertyValue ( const QCString &  propName  )  [virtual]

Returns:
property value for propeName available for this driver.

If there's no such property defined for driver, Null QVariant value is returned.

Definition at line 505 of file keximigrate.cpp.

void KexiMigrate::setPropertyValue ( const QCString &  propName,
const QVariant &  value 
)

Todo:
This is copied from KexiDB::Driver. One day it will be merged with KexiDB.

Definition at line 515 of file keximigrate.cpp.

QString KexiMigrate::propertyCaption ( const QCString &  propName  )  const

Returns:
translated property caption for propeName.

If there's no such property defined for driver, empty string value is returned.

Definition at line 510 of file keximigrate.cpp.

QValueList< QCString > KexiMigrate::propertyNames (  )  const

Returns:
a list of property names available for this driver.

Todo:
This is copied from KexiDB::Driver. One day it will be merged with KexiDB.

Definition at line 520 of file keximigrate.cpp.

bool KexiMigrate::isValid (  )  [virtual]

Returns:
true is driver is valid. Checks if KexiMigrate::versionMajor() and KexiMigrate::versionMinor() are matching. You can reimplement this but always call KexiMigrate::isValid() implementation.

Definition at line 527 of file keximigrate.cpp.

virtual bool KexiMigration::KexiMigrate::drv_connect (  )  [protected, pure virtual]

Connect to source database (driver specific).

Implemented in KexiMigration::MySQLMigrate, and KexiMigration::PqxxMigrate.

virtual bool KexiMigration::KexiMigrate::drv_disconnect (  )  [protected, pure virtual]

Disconnect from source database (driver specific).

Implemented in KexiMigration::MySQLMigrate, and KexiMigration::PqxxMigrate.

virtual bool KexiMigration::KexiMigrate::drv_tableNames ( QStringList &  tablenames  )  [protected, pure virtual]

Get table names in source database (driver specific).

Implemented in KexiMigration::MySQLMigrate, and KexiMigration::PqxxMigrate.

virtual bool KexiMigration::KexiMigrate::drv_readTableSchema ( const QString &  originalName,
KexiDB::TableSchema tableSchema 
) [protected, pure virtual]

Read schema for a given table (driver specific).

Implemented in KexiMigration::MySQLMigrate, and KexiMigration::PqxxMigrate.

virtual bool KexiMigration::KexiMigrate::drv_copyTable ( const QString &  srcTable,
KexiDB::Connection destConn,
KexiDB::TableSchema dstTable 
) [protected, pure virtual]

Copy a table from source DB to target DB (driver specific).

Implemented in KexiMigration::MySQLMigrate, and KexiMigration::PqxxMigrate.

virtual bool KexiMigration::KexiMigrate::drv_getTableSize ( const QString &  ,
Q_ULLONG &   
) [inline, protected, virtual]

Returns:
the size of a table to be imported, or 0 if not supported Finds the size of the named table, in order to provide feedback on migration progress.
The units of the return type are deliberately unspecified. Migration drivers may return the number of records in the table, or the size in bytes, etc. Units should be chosen in order that the driver can return the size in the fastest way possible (e.g. migration from CSV files should use file size to avoid counting the number of rows, and migration from MDB files should return the number of rows as this is stored within the file).

Obviously, the driver should use the same units when reporting migration progress.

Returns:
size of the specified table

Reimplemented in KexiMigration::MySQLMigrate.

Definition at line 182 of file keximigrate.h.

KexiDB::Field::Type KexiMigrate::userType ( const QString &  fname  )  [protected]

Prompt user to select a field type for unrecognized fields.

Todo:
user should be asked ONCE using a convenient wizard's page, not a popup dialog

Todo:
use QMap<QCString, KexiDB::Field::Type> here!

Definition at line 448 of file keximigrate.cpp.


Member Data Documentation

Migrate Options.

Todo:
Remove this! KexiMigrate should be usable for multiple concurrent migrations!

Definition at line 193 of file keximigrate.h.

QMap<QCString,QVariant> KexiMigration::KexiMigrate::m_properties [protected]

Driver properties dictionary (indexed by name), useful for presenting properties to the user. Set available properties here in driver implementation.

Definition at line 201 of file keximigrate.h.

QMap<QCString,QString> KexiMigration::KexiMigrate::m_propertyCaptions [protected]

i18n'd captions for properties. You do not need to set predefined properties' caption in driver implementation -it's done automatically.

Definition at line 206 of file keximigrate.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys