Changeset View
Changeset View
Standalone View
Standalone View
src/migration/importtablewizard.cpp
Show First 20 Lines • Show All 445 Lines • ▼ Show 20 Line(s) | 443 | if (!readFromTable()) { | |||
---|---|---|---|---|---|
446 | KMessageBox::information(this, | 446 | KMessageBox::information(this, | ||
447 | xi18nc("@info", "Could not import table <resource>%1</resource>. " | 447 | xi18nc("@info", "Could not import table <resource>%1</resource>. " | ||
448 | "Select different table or cancel importing.", m_importTableName)); | 448 | "Select different table or cancel importing.", m_importTableName)); | ||
449 | } | 449 | } | ||
450 | } | 450 | } | ||
451 | 451 | | |||
452 | bool ImportTableWizard::readFromTable() | 452 | bool ImportTableWizard::readFromTable() | ||
453 | { | 453 | { | ||
454 | QScopedPointer<KDbSqlResult> tableResult(m_migrateDriver->readFromTable(m_importTableName)); | 454 | QSharedPointer<KDbSqlResult> tableResult = m_migrateDriver->readFromTable(m_importTableName); | ||
455 | KDbTableSchema *newSchema = m_alterSchemaWidget->newSchema(); | 455 | KDbTableSchema *newSchema = m_alterSchemaWidget->newSchema(); | ||
456 | if (!tableResult || tableResult->lastResult().isError() | 456 | if (!tableResult || tableResult->lastResult().isError() | ||
457 | || tableResult->fieldsCount() != newSchema->fieldCount()) | 457 | || tableResult->fieldsCount() != newSchema->fieldCount()) | ||
458 | { | 458 | { | ||
459 | back(); | 459 | back(); | ||
460 | KMessageBox::information(this, | 460 | KMessageBox::information(this, | ||
461 | xi18nc("@info", "Could not import table <resource>%1</resource>. " | 461 | xi18nc("@info", "Could not import table <resource>%1</resource>. " | ||
462 | "Select different table or cancel importing.", m_importTableName)); | 462 | "Select different table or cancel importing.", m_importTableName)); | ||
463 | return false; | 463 | return false; | ||
464 | } | 464 | } | ||
465 | QScopedPointer<QList<KDbRecordData*>> data(new QList<KDbRecordData*>); | 465 | QScopedPointer<QList<KDbRecordData*>> data(new QList<KDbRecordData*>); | ||
466 | for (int i = 0; i < RECORDS_FOR_PREVIEW; ++i) { | 466 | for (int i = 0; i < RECORDS_FOR_PREVIEW; ++i) { | ||
467 | QScopedPointer<KDbRecordData> record(tableResult->fetchRecordData()); | 467 | QSharedPointer<KDbRecordData> record(tableResult->fetchRecordData()); | ||
468 | if (!record) { | 468 | if (!record) { | ||
469 | if (tableResult->lastResult().isError()) { | 469 | if (tableResult->lastResult().isError()) { | ||
470 | return false; | 470 | return false; | ||
471 | } | 471 | } | ||
472 | break; | 472 | break; | ||
473 | } | 473 | } | ||
474 | data->append(record.data()); | 474 | data->append(record.data()); | ||
475 | } | 475 | } | ||
▲ Show 20 Lines • Show All 284 Lines • Show Last 20 Lines |