Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/tables/kexitabledesignerview.cpp
1 | /* This file is part of the KDE project | 1 | /* This file is part of the KDE project | ||
---|---|---|---|---|---|
2 | Copyright (C) 2004-2012 Jarosław Staniek <staniek@kde.org> | 2 | Copyright (C) 2004-2017 Jarosław Staniek <staniek@kde.org> | ||
3 | 3 | | |||
4 | This program is free software; you can redistribute it and/or | 4 | This program is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public | ||
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either | ||
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. | ||
8 | 8 | | |||
9 | This program is distributed in the hope that it will be useful, | 9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
▲ Show 20 Lines • Show All 1409 Lines • ▼ Show 20 Line(s) | 1419 | { | |||
1420 | realAlterTableCanBeUsed = true; | 1420 | realAlterTableCanBeUsed = true; | ||
1421 | } | 1421 | } | ||
1422 | } | 1422 | } | ||
1423 | } | 1423 | } | ||
1424 | 1424 | | |||
1425 | if (res == true) { | 1425 | if (res == true) { | ||
1426 | res = KexiTablePart::askForClosingObjectsUsingTableSchema( | 1426 | res = KexiTablePart::askForClosingObjectsUsingTableSchema( | ||
1427 | window(), conn, tempData()->table(), | 1427 | window(), conn, tempData()->table(), | ||
1428 | xi18nc("@info", | 1428 | kxi18nc("@info", | ||
1429 | "You are about to change the design of table <resource>%1</resource> " | 1429 | "<para>You are about to change the design of table <resource>%1</resource> " | ||
1430 | "but following objects using this table are opened:", | 1430 | "but following objects using this table are opened:</para>") | ||
piggz: but the following....are open: | |||||
1431 | tempData()->table()->name())); | 1431 | .subs(tempData()->table()->name())); | ||
1432 | } | 1432 | } | ||
1433 | 1433 | | |||
1434 | if (res == true) { | 1434 | if (res == true) { | ||
1435 | if (!d->tempStoreDataUsingRealAlterTable && !realAlterTableCanBeUsed) { | 1435 | if (!d->tempStoreDataUsingRealAlterTable && !realAlterTableCanBeUsed) { | ||
1436 | //! @todo temp; remove this case: | 1436 | //! @todo temp; remove this case: | ||
1437 | delete alterTableHandler; | 1437 | delete alterTableHandler; | ||
1438 | alterTableHandler = 0; | 1438 | alterTableHandler = 0; | ||
1439 | // - inform about removing the current table and ask for confirmation | 1439 | // - inform about removing the current table and ask for confirmation | ||
Show All 17 Lines | |||||
1457 | } | 1457 | } | ||
1458 | // keep old behaviour: | 1458 | // keep old behaviour: | ||
1459 | newTable = new KDbTableSchema(); | 1459 | newTable = new KDbTableSchema(); | ||
1460 | // copy the object data | 1460 | // copy the object data | ||
1461 | static_cast<KDbObject&>(*newTable) | 1461 | static_cast<KDbObject&>(*newTable) | ||
1462 | = static_cast<KDbObject&>(*tempData()->table()); | 1462 | = static_cast<KDbObject&>(*tempData()->table()); | ||
1463 | res = buildSchema(*newTable); | 1463 | res = buildSchema(*newTable); | ||
1464 | qDebug() << "BUILD SCHEMA:" << *newTable; | 1464 | qDebug() << "BUILD SCHEMA:" << *newTable; | ||
1465 | 1465 | { | |||
1466 | res = conn->alterTable(tempData()->table(), newTable); | 1466 | KDbTableSchema *oldTable = tempData()->table(); | ||
1467 | tempData()->setTable(nullptr); // needed, otherwise setTable() will access dangling | ||||
1468 | // pointer after conn->alterTable() | ||||
1469 | KexiUtils::BoolBlocker guard(&tempData()->closeWindowOnCloseListener, false); | ||||
1470 | res = conn->alterTable(oldTable, newTable); | ||||
1471 | } | ||||
1467 | if (res != true) | 1472 | if (res != true) | ||
1468 | window()->setStatus(conn, ""); | 1473 | window()->setStatus(conn, ""); | ||
1469 | } else { | 1474 | } else { | ||
1470 | KDbAlterTableHandler::ExecutionArguments args; | 1475 | KDbAlterTableHandler::ExecutionArguments args; | ||
1471 | newTable = alterTableHandler->execute(tempData()->table()->name(), &args); | 1476 | newTable = alterTableHandler->execute(tempData()->table()->name(), &args); | ||
1472 | res = args.result; | 1477 | res = args.result; | ||
1473 | qDebug() << "ALTER TABLE EXECUTE: " | 1478 | qDebug() << "ALTER TABLE EXECUTE: " | ||
1474 | << res.toString(); | 1479 | << res.toString(); | ||
▲ Show 20 Lines • Show All 422 Lines • Show Last 20 Lines |
but the following....are open: