3
* TOra - An Oracle Toolkit for DBA's and developers
4
* Copyright (C) 2003-2005 Quest Software, Inc
5
* Portions Copyright (C) 2005 Other Contributors
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; only version 2 of
10
* the License is valid for this program.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
* As a special exception, you have permission to link this program
22
* with the Oracle Client libraries and distribute executables, as long
23
* as you follow the requirements of the GNU GPL in regard to all of the
24
* software in the executable aside from Oracle client libraries.
26
* Specifically you are not permitted to link this program with the
27
* Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech.
28
* And you are not permitted to distribute binaries compiled against
29
* these libraries without written consent from Quest Software, Inc.
30
* Observe that this does not disallow linking to the Qt Free Edition.
32
* You may link this product with any GPL'd Qt library such as Qt/Free
34
* All trademarks belong to their respective owners.
2
/* BEGIN_COMMON_COPYRIGHT_HEADER
4
* TOra - An Oracle Toolkit for DBA's and developers
6
* Shared/mixed copyright is held throughout files in this product
8
* Portions Copyright (C) 2000-2001 Underscore AB
9
* Portions Copyright (C) 2003-2005 Quest Software, Inc.
10
* Portions Copyright (C) 2004-2008 Numerous Other Contributors
12
* This program is free software; you can redistribute it and/or
13
* modify it under the terms of the GNU General Public License
14
* as published by the Free Software Foundation; only version 2 of
15
* the License is valid for this program.
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
22
* You should have received a copy of the GNU General Public License
23
* along with this program; if not, write to the Free Software
24
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
* As a special exception, you have permission to link this program
27
* with the Oracle Client libraries and distribute executables, as long
28
* as you follow the requirements of the GNU GPL in regard to all of the
29
* software in the executable aside from Oracle client libraries.
31
* Specifically you are not permitted to link this program with the
32
* Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech.
33
* And you are not permitted to distribute binaries compiled against
36
* You may link this product with any GPL'd Qt library.
38
* All trademarks belong to their respective owners.
40
* END_COMMON_COPYRIGHT_HEADER */
46
50
#include "totableselect.h"
48
52
#include <qapplication.h>
49
#include <qbuttongroup.h>
50
53
#include <qcombobox.h>
51
54
#include <qinputdialog.h>
52
55
#include <qlabel.h>
53
56
#include <qlineedit.h>
54
#include <qprogressdialog.h>
55
57
#include <qradiobutton.h>
56
58
#include <qtimer.h>
57
#include <qwidgetstack.h>
59
#include "tobrowserconstraint.moc"
60
#include "tobrowserconstraintui.moc"
60
#include <QStackedWidget>
61
#include <QProgressDialog>
62
64
void toBrowserConstraint::modifyConstraint(toConnection &conn, const QString &owner, const QString &table, QWidget *parent)
93
96
toBrowserConstraint::toBrowserConstraint(toConnection &conn, const QString &owner, const QString &table, QWidget *parent, const char *name)
94
: toBrowserConstraintUI(parent, name, true), toConnectionWidget(conn, this), Extractor(conn, NULL)
97
: QDialog(parent), toConnectionWidget(conn, this), Extractor(conn, NULL)
96
103
Extractor.setIndexes(false);
97
104
Extractor.setConstraints(true);
98
105
Extractor.setPrompt(false);
267
274
if (Table.isEmpty())
270
QString name = QInputDialog::getText(tr("Enter new constraint name"),
277
QString name = QInputDialog::getText(this,
278
tr("Enter new constraint name"),
271
279
tr("Enter name of new constraint."),
272
QLineEdit::Normal, QString::null, &ok, this);
275
Name->insertItem(name);
276
Name->setCurrentItem(Name->count() - 1);
286
Name->setCurrentIndex(Name->count() - 1);
277
287
changeConstraint();
374
384
if (!table.isEmpty() && !sourceCols.isEmpty() && !destinCols.isEmpty())
375
385
newDefinition = "FOREIGN KEY (" + sourceCols + ") REFERENCES " + table + " (" + destinCols + ")";
377
else if (WidgetStack->visibleWidget() == PrimaryPage)
387
else if (WidgetStack->currentIndex() == WidgetStack->indexOf(PrimaryPage))
379
389
QString columns = UniqueCols->text();
380
390
if (!columns.isEmpty())
381
391
newDefinition = (Primary->isChecked() ? "PRIMARY KEY (" : "UNIQUE (") + columns + ")";
383
else if (WidgetStack->visibleWidget() == CheckPage)
393
else if (WidgetStack->currentIndex() == WidgetStack->indexOf(CheckPage))
385
395
QString checkCondition = CheckCondition->text();
386
396
if (!checkCondition.isEmpty())