Exemplo n.º 1
0
bool KexiMigrate::isSourceAndDestinationDataSourceTheSame() const
{
    KexiDB::ConnectionData* sourcedata = m_migrateData->source;
    KexiDB::ConnectionData* destinationdata = m_migrateData->destination->connectionData();
    return (
               sourcedata && destinationdata &&
               m_migrateData->sourceName == m_migrateData->destination->databaseName() && // same database name
               sourcedata->driverName == destinationdata->driverName && // same driver
               sourcedata->hostName == destinationdata->hostName && // same host
               sourcedata->fileName() == destinationdata->fileName() && // same filename
               sourcedata->dbPath() == destinationdata->dbPath() && // same database path
               sourcedata->dbFileName() == destinationdata->dbFileName() // same database filename
           );
}
Exemplo n.º 2
0
bool MDBMigrate::drv_connect()
{
    kDebug() << "mdb_open:";
    KexiDB::ConnectionData *data = this->data()->source;

    // mdb_open takes a char*, not const char*, hence this nonsense.
    char *filename = qstrdup(QFile::encodeName(data->fileName()));
    m_mdb = mdb_open(filename, MDB_NOFLAGS);
    delete [] filename;

    if (!m_mdb) {
        kWarning() << "mdb_open failed.";
        return false;
    }

    // Setting source encoding
    if (!propertyValue(nonUnicodePropId).toString().isEmpty()) {
        const QByteArray encoding(propertyValue(nonUnicodePropId).toByteArray());

        mdb_set_encoding(m_mdb, encoding.constData());
        kDebug() << "non-unicode encoding set to" << encoding;
    }

    // Supports setting source encoding
    setPropertyValue(isNonUnicodePropId, bool(IS_JET3(m_mdb)));

    return true;
}
Exemplo n.º 3
0
bool MDBMigrate::drv_connect()
{
    kDebug() << "mdb_open:";
    KexiDB::ConnectionData *data = m_migrateData->source;

    // mdb_open takes a char*, not const char*, hence this nonsense.
    char *filename = qstrdup(QFile::encodeName(data->fileName()));
    m_mdb = mdb_open(filename, MDB_NOFLAGS);
    delete [] filename;

    if (!m_mdb) {
        kDebug() << "mdb_open failed.";
        return false;
    }

    // Setting source encoding
    if (!m_properties[ nonUnicodePropId ].toString().isEmpty()) {
        const QByteArray encoding(m_properties[ nonUnicodePropId ].toByteArray());

        mdb_set_encoding(m_mdb, encoding.constData());
        kDebug() << "non-unicode encoding set to \""
        << encoding
        << "\"";
    }

    // Supports setting source encoding
    m_properties[ isNonUnicodePropId ] = QVariant((bool)IS_JET3(m_mdb));

    return true;
}