Public Slots | Signals | Public Member Functions | Public Attributes | Protected Member Functions

tableEditor Class Reference

Used when creating or altering a database table. Used to generate a query to perfor these tasks. More...

#include <tableeditor.h>

List of all members.

Public Slots

void generateQuery ()

Signals

void closeMe ()

Public Member Functions

 tableEditor (QWidget *parent=0)
 ~tableEditor ()
void loadDatabaseList (QString defaultDb)
 Used to load all databases in the server. defaultDb is then set as the selected item.
void addColumn (QString strColName, QString length, QString datType, QString isNull, QString strAutoInc, QString primaryKey, QString strDefault, bool specifiedPosition, int position)
void saveTable ()
 Executes the generated query when in create mode.
void saveEditedTable ()
 Executes the generated query when in edit mode.
void editTable ()
void startEdit (QString tableName, QString dbName)
void updateEdit ()
void insertColumn (QString after)

Public Attributes

QSqlDatabase db
 The database whence all queries run.
QIcon dbIcon
 Icon to be used in the database list combo box.
bool isEditing
QHash< int, QCheckBox * > notNulls
QHash< int, QCheckBox * > autoIncrements
QHash< int, QComboBox * > dataTypes
QHash< int, QCheckBox * > primaryKeys
QHash< int, QString > m_originalName
QHash< int, bool * > toDelete
QHash< int, QString > m_originalNotNull
QHash< int, QString > m_originalAutoInc
QHash< int, QString > m_originalPrimKey
QHash< int, QString > m_originalDataType
QHash< int, QString > m_originalDefault
QHash< int, QString > m_originalLength
QMdiArea * par

Protected Member Functions

void changeEvent (QEvent *e)

Detailed Description

Used when creating or altering a database table. Used to generate a query to perfor these tasks.

Todo:

Fix errors when altering table.

Use QsciScitilla instead of QTextEdit.

Definition at line 19 of file tableeditor.h.


Constructor & Destructor Documentation

tableEditor::tableEditor ( QWidget *  parent = 0 ) [explicit]

Definition at line 7 of file tableeditor.cpp.

References isEditing.

                                        :
        QMainWindow(parent),
        ui(new Ui::tableEditor)
{
    ui->setupUi(this);
    isEditing = false;
    ui->txtTableName->setText("New Table");
    Highlighter *high;
    high = new Highlighter(ui->txtQuery->document());
}
tableEditor::~tableEditor (  )

Definition at line 18 of file tableeditor.cpp.

{
    delete ui;
}

Member Function Documentation

void tableEditor::addColumn ( QString  strColName,
QString  length,
QString  datType,
QString  isNull,
QString  strAutoInc,
QString  primaryKey,
QString  strDefault,
bool  specifiedPosition,
int  position 
)

Adds a new column to the column list.

strColName Is the column name. length is the column length. datType is the column's MySQL data type. isNull specifies whether the column allows nulls. Can be YES or NO. Default is YES strAutoInc specifies whether the column is an auto complete column. Can be YES or NO. Default is NO primaryKey specifies whether the column is a primary key. Can be YES or NO. Default is NO. strDefault specifies the default text for the column. Default is a null string. specifiedPosition determines whether the position of the new column in the table is defined, or the column will appear at the end of the list. position is used when specifiedPosition is true to specify the posotion of the new column in the table.

Definition at line 239 of file tableeditor.cpp.

References autoIncrements, dataTypes, GPublics::mysqlDatatypes(), notNulls, and primaryKeys.

Referenced by startEdit().

{
    int rowNum = ui->tblColumns->rowCount();
    if (specifiedPosition == true) {
        QMessageBox::information(this, "", "Specific");
        rowNum = position;
    }
    ui->tblColumns->insertRow(rowNum);    
    ComboBoxDelegate delegate;
    ui->tblColumns->setItemDelegateForColumn(1, &delegate);
    QString m_strColName, m_strDataType;
    //data type combo box
    QComboBox *cbo = new QComboBox(this);
    cbo->setEditable(true);
    GPublics *pubs = new GPublics();
    cbo->insertItems(0, pubs->mysqlDatatypes());
    //not null check box
    QCheckBox *m_chkNotNull = new QCheckBox(this);
    m_chkNotNull->setChecked(false);
    if (isNull == "NO") {  m_chkNotNull->setChecked(true); }
    //auto increment check box
    QCheckBox *m_chkAutoInc = new QCheckBox(this);
    m_chkAutoInc->setChecked(false);
    if (strAutoInc == "YES") { m_chkAutoInc->setChecked(true); }
    //primary key check box
    QCheckBox *m_chkPrimaryKey = new QCheckBox(this);
    m_chkPrimaryKey->setChecked(false);
    if (primaryKey == "YES") { m_chkPrimaryKey->setChecked(true); }
    //
    m_strDataType = datType;
    cbo->setEditText(datType);
    m_strColName = strColName;

    QTableWidgetItem *colName = new QTableWidgetItem(m_strColName, 1);
    ui->tblColumns->setItem(rowNum, 0, colName);
    QTableWidgetItem *dataType = new QTableWidgetItem(m_strDataType, 1);
    dataType->text() = datType;
    ui->tblColumns->setItem(rowNum, 1, dataType);

    QTableWidgetItem *m_itemLength = new QTableWidgetItem(length, 1);
    ui->tblColumns->setItem(rowNum, 2, m_itemLength);
    QTableWidgetItem *m_itemDefault = new QTableWidgetItem(strDefault, 1);
    ui->tblColumns->setItem(rowNum, 3, m_itemDefault);
    QTableWidgetItem *notNull = new QTableWidgetItem("", 1);
    ui->tblColumns->setItem(rowNum, 4, notNull);
    QTableWidgetItem *autoInc = new QTableWidgetItem("", 1);
    ui->tblColumns->setItem(rowNum, 5, autoInc);
    QTableWidgetItem *m_itemPrimaryKey = new QTableWidgetItem("", 1);
    ui->tblColumns->setItem(rowNum, 6, m_itemPrimaryKey);
    dataTypes.insert(rowNum, cbo);
    notNulls.insert(rowNum, m_chkNotNull);
    autoIncrements.insert(rowNum, m_chkAutoInc);
    primaryKeys.insert(rowNum, m_chkPrimaryKey);
    ui->tblColumns->setCellWidget(rowNum, 1, cbo);
    ui->tblColumns->setCellWidget(rowNum, 4, m_chkNotNull);
    ui->tblColumns->setCellWidget(rowNum, 5, m_chkAutoInc);
    ui->tblColumns->setCellWidget(rowNum, 6, m_chkPrimaryKey);
    ui->tblColumns->resizeRowToContents(rowNum);

    if (specifiedPosition) {
        for (int i = 0; i < ui->tblColumns->columnCount(); i++) {
            QTableWidgetItem *it = ui->tblColumns->item(rowNum, i);
            it->setBackgroundColor(Qt::lightGray);
        }
    } else {
        for (int i = 0; i < ui->tblColumns->columnCount(); i++) {
            QTableWidgetItem *it = ui->tblColumns->item(rowNum, i);
            it->setBackgroundColor(Qt::white);
        }
    }
}
void tableEditor::changeEvent ( QEvent *  e ) [protected]

Definition at line 23 of file tableeditor.cpp.

{
    QMainWindow::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}
void tableEditor::closeMe (  ) [signal]
void tableEditor::editTable (  )

Definition at line 45 of file tableeditor.cpp.

References autoIncrements, dataTypes, m_originalName, notNulls, and primaryKeys.

                            {
    for (int i = 0; i < ui->tblColumns->rowCount(); i++) {
        if (i < m_originalName.count()) {
            QString m_strColName = "";
            QString m_strDataType = "";
            QString m_strLength = "";
            QString m_strDefault = "";
            QString m_strNotNull = "";
            QString m_strAutoIncrement = "";
            QString m_strPrimaryKey;
            QTableWidgetItem *m_itemColName = ui->tblColumns->item(i, 0);
            QComboBox *m_cboDataTypes = dataTypes[i];
            QCheckBox *m_chkNull = notNulls[i];
            QCheckBox *m_chkAuto = autoIncrements[i];
            QCheckBox *m_chkPrim = primaryKeys[i]; m_strColName = m_itemColName->text();
            m_strDataType = m_cboDataTypes->currentText();
            m_strLength = ui->tblColumns->item(i, 2)->text();
            m_strDefault = ui->tblColumns->item(i, 3)->text();
            if (m_strDefault.length() < 1) {
                m_strDefault = "";
            } else { m_strDefault = tr("DEFAULT `%1`").arg(m_strDefault); }
            if (m_strDataType.toUpper() == "VARCHAR") {
                if (m_strLength.length() < 1) { m_strLength = "10"; }
                m_strDataType = tr("VARCHAR(%1)").arg(m_strLength);
            } else { m_strDataType = m_strDataType; }
            int m_chkNotNull  = m_chkNull->checkState();
            if (m_chkNotNull == 2) {
                m_strNotNull = "NOT NULL";
            } else { m_strNotNull = ""; }
            int m_chkAutoIncr = m_chkAuto->checkState();
            if (m_chkAutoIncr == 2) {
                m_strAutoIncrement = "AUTO_INCREMENT";
            } else { m_strAutoIncrement ="" ; }
            int m_intPrim = m_chkPrim->checkState();
            if (m_intPrim == 2) {
                m_strPrimaryKey = m_strColName;
            } else  {m_strPrimaryKey = ""; }
        }
    }
}
void tableEditor::generateQuery (  ) [slot]

Definition at line 558 of file tableeditor.cpp.

References autoIncrements, dataTypes, m_originalName, notNulls, and primaryKeys.

                                {
    //capture column changes and create a query
    QString m_strQuery = tr("ALTER TABLE `%1`.`%2` ").arg(ui->comboBox->currentText(), ui->txtTableName->text());
    for (int i = 0; i <  ui->tblColumns->rowCount(); i++) {
        QTableWidgetItem *it = ui->tblColumns->item(i, 0);
        if (it->backgroundColor() == Qt::red) {
            m_strQuery.append(tr("\n\tDROP COLUMN `%1`,").arg(it->text()));
        } else if (it->backgroundColor() == Qt::yellow) {
            QString m_strColName = "";
            QString m_strDataType = "";
            QString m_strLength = "";
            QString m_strDefault = "";
            QString m_strNotNull = "";
            QString m_strAutoIncrement = "";
            QString m_strPrimaryKey;
            QTableWidgetItem *m_itemColName = ui->tblColumns->item(i, 0);
            QComboBox *m_cboDataTypes = dataTypes[i];
            QCheckBox *m_chkNull = notNulls[i];
            QCheckBox *m_chkAuto = autoIncrements[i];
            QCheckBox *m_chkPrim = primaryKeys[i];
            m_strColName = m_itemColName->text();
            m_strDataType = m_cboDataTypes->currentText();
            m_strLength = ui->tblColumns->item(i, 2)->text();
            m_strDefault = ui->tblColumns->item(i, 3)->text();
            if (m_strDefault.length() < 1) {
                m_strDefault = "";
            } else { m_strDefault = tr("DEFAULT `%1`").arg(m_strDefault); }

            if (m_strDataType.toLower() == "varchar") {
                if (m_strLength.length() < 1) { m_strLength = "10"; }
                m_strDataType = tr("varchar(%1)").arg(m_strLength);
            } else { m_strDataType = m_strDataType; }

            int m_chkNotNull  = m_chkNull->checkState();
            if (m_chkNotNull == 2) {
                m_strNotNull = "NOT NULL";
            } else { m_strNotNull = ""; }
            int m_chkAutoIncr = m_chkAuto->checkState();
            if (m_chkAutoIncr == 2) {
                m_strAutoIncrement = "AUTO_INCREMENT";
            } else { m_strAutoIncrement ="" ; }
            int m_intPrim = m_chkPrim->checkState();
            if (m_intPrim == 2) {
                m_strPrimaryKey = m_strColName;
            } else  {m_strPrimaryKey = ""; }

            //            if (m_strPrimaryKey.length() > 0) {
            //                if (m_primaryKeys.length() > 0) {
            //                    m_strPrimaryKey = tr(", %1").arg(m_strPrimaryKey);
            //                }
            //                m_primaryKeys = tr("%1 %2").arg(m_primaryKeys, m_strPrimaryKey);
            //            }
            QString  m_createTable = tr("%1 %2").arg(m_createTable, tr("`%1` %2 %3 %4 %5,").arg(m_strColName, m_strDataType, m_strNotNull, m_strAutoIncrement, m_strDefault));


            m_strQuery.append(tr("\n\tALTER `%1` %2").arg(m_originalName[i], m_createTable));
        }
    }
    m_strQuery = m_strQuery.left(m_strQuery.length() - 1);
    m_strQuery.append(";");


    ui->txtQuery->setText(m_strQuery);
}
void tableEditor::insertColumn ( QString  after )

Definition at line 670 of file tableeditor.cpp.

                                            {
    if (after != "") {

    } else {

    }
}
void tableEditor::loadDatabaseList ( QString  defaultDb )

Used to load all databases in the server. defaultDb is then set as the selected item.

Definition at line 35 of file tableeditor.cpp.

References db.

                                                    {
    QSqlQuery *qu = new QSqlQuery("show databases", db);
    if (qu->lastError().isValid() == false) {
        while (qu->next()) {
            ui->comboBox->insertItem(ui->comboBox->count(), QIcon("://icons/Icon_45.ico"), qu->value(0).toString());
        }
        ui->comboBox->setEditText(defaultDb);
    }
}
void tableEditor::saveEditedTable (  )

Executes the generated query when in edit mode.

Definition at line 158 of file tableeditor.cpp.

References autoIncrements, dataTypes, m_originalName, notNulls, and primaryKeys.

Referenced by saveTable(), and startEdit().

                                  {
    QString m_createTable = "";
    QString m_primaryKeys = "";
    m_createTable = tr("ALTER TABLE `%1`.`%2` \n").arg(ui->comboBox->currentText(), ui->txtTableName->text());

    for (int i = 0; i < ui->tblColumns->rowCount(); i++) {
        if (i < m_originalName.count()) {
            QString m_strColName = "";
            QString m_strDataType = "";
            QString m_strLength = "";
            QString m_strDefault = "";
            QString m_strNotNull = "";
            QString m_strAutoIncrement = "";
            QString m_strPrimaryKey;
            QTableWidgetItem *m_itemColName = ui->tblColumns->item(i, 0);
            QComboBox *m_cboDataTypes = dataTypes[i];
            QCheckBox *m_chkNull = notNulls[i];
            QCheckBox *m_chkAuto = autoIncrements[i];
            QCheckBox *m_chkPrim = primaryKeys[i];
            //==4
            m_strColName = m_itemColName->text();
            m_strDataType = m_cboDataTypes->currentText();
            m_strLength = ui->tblColumns->item(i, 2)->text();
            m_strDefault = ui->tblColumns->item(i, 3)->text();
            if (m_strDefault.length() < 1) {
                m_strDefault = "";
            } else { m_strDefault = tr("DEFAULT '%1'").arg(m_strDefault); }

            if (m_strDataType.toLower() == "varchar") {
                if (m_strLength.length() < 1) { m_strLength = "10"; }
                m_strDataType = tr("varchar(%1)").arg(m_strLength);
            } else { m_strDataType = m_strDataType; }

            int m_chkNotNull  = m_chkNull->checkState();
            if (m_chkNotNull == 2) {
                m_strNotNull = "NOT NULL";
            } else { m_strNotNull = ""; }
            int m_chkAutoIncr = m_chkAuto->checkState();
            if (m_chkAutoIncr == 2) {
                m_strAutoIncrement = "AUTO_INCREMENT";
            } else { m_strAutoIncrement ="" ; }
            int m_intPrim = m_chkPrim->checkState();
            if (m_intPrim == 2) {
                m_strPrimaryKey = m_strColName;
            } else  {m_strPrimaryKey = ""; }

            if (m_strPrimaryKey.length() > 0) {
                if (m_primaryKeys.length() > 0) {
                    m_strPrimaryKey = tr(", %1").arg(m_strPrimaryKey);
                }
                m_primaryKeys = tr("%1 %2").arg(m_primaryKeys, m_strPrimaryKey);
            }
            QTableWidgetItem *it = ui->tblColumns->item(i, 0);
            if (it->backgroundColor() == Qt::red){
                //column deleted
                QString dropText = tr(" DROP COLUMN `%1`").arg(m_originalName[i]);
                m_createTable = tr("%1 %2,\n").arg(m_createTable, dropText);
            } else if (it->backgroundColor() == Qt::lightGray) {
                QTableWidgetItem *it2 = ui->tblColumns->item(i - 1, 0);
                m_createTable = tr("%1 %2").arg(m_createTable,
                                                tr(" ADD COLUMN `%1` %2 %3 %4 %5 AFTER `%6`,\n")
                                                .arg(m_strColName, m_strDataType, m_strNotNull, m_strAutoIncrement,
                                                     m_strDefault, it2->text()));
            } else {
                m_createTable = tr("%1 %2").arg(m_createTable, tr(" CHANGE `%1` `%2` %3 %4 %5 %6,\n").arg(m_originalName[i] ,m_strColName, m_strDataType, m_strNotNull, m_strAutoIncrement, m_strDefault));
            }
        }
    }
    if (ui->txtTableName->text().length() < 1) {
        QMessageBox::warning(this, "Error", "Enter the table name.");
        ui->txtTableName->setFocus();
    }
    else {
        m_createTable = tr("%1 DROP PRIMARY KEY,\n ADD PRIMARY KEY(%2)\n\n/* Query Generated by Smart MySQL Tool*/\n/*(c)Joshua Wambua 2010 */").arg(m_createTable, m_primaryKeys);
        ui->txtQuery->setText(m_createTable);
    }
}
void tableEditor::saveTable (  )

Executes the generated query when in create mode.

Definition at line 87 of file tableeditor.cpp.

References autoIncrements, dataTypes, isEditing, notNulls, primaryKeys, and saveEditedTable().

                            {
    QString m_createTable = "";
    QString m_primaryKeys = "";
    if (isEditing) { saveEditedTable(); }  else {
        m_createTable = tr("CREATE TABLE `%1`.`%2` (\n").arg(ui->comboBox->currentText(), ui->txtTableName->text());

        for (int i = 0; i < ui->tblColumns->rowCount(); i++) {
            QString m_strColName = "";
            QString m_strDataType = "";
            QString m_strLength = "";
            QString m_strDefault = "";
            QString m_strNotNull = "";
            QString m_strAutoIncrement = "";
            QString m_strPrimaryKey;
            QTableWidgetItem *m_itemColName = ui->tblColumns->item(i, 0);
            QComboBox *m_cboDataTypes = dataTypes[i];
            QCheckBox *m_chkNull = notNulls[i];
            QCheckBox *m_chkAuto = autoIncrements[i];
            QCheckBox *m_chkPrim = primaryKeys[i];
            m_strColName = m_itemColName->text();
            m_strDataType = m_cboDataTypes->currentText();
            m_strLength = ui->tblColumns->item(i, 2)->text();
            m_strDefault = ui->tblColumns->item(i, 3)->text();
            if (m_strDefault.length() < 1) {
                m_strDefault = "";
            } else { m_strDefault = tr("DEFAULT `%1`").arg(m_strDefault); }

            if (m_strDataType.toLower() == "varchar") {
                if (m_strLength.length() < 1) { m_strLength = "10"; }
                m_strDataType = tr("varchar(%1)").arg(m_strLength);
            } else { m_strDataType = m_strDataType; }

            int m_chkNotNull  = m_chkNull->checkState();
            if (m_chkNotNull == 2) {
                m_strNotNull = "NOT NULL";
            } else { m_strNotNull = ""; }
            int m_chkAutoIncr = m_chkAuto->checkState();
            if (m_chkAutoIncr == 2) {
                m_strAutoIncrement = "AUTO_INCREMENT";
            } else { m_strAutoIncrement ="" ; }
            int m_intPrim = m_chkPrim->checkState();
            if (m_intPrim == 2) {
                m_strPrimaryKey = m_strColName;
            } else  {m_strPrimaryKey = ""; }

            if (m_strPrimaryKey.length() > 0) {
                if (m_primaryKeys.length() > 0) {
                    m_strPrimaryKey = tr(", %1").arg(m_strPrimaryKey);
                }
                m_primaryKeys = tr("%1 %2").arg(m_primaryKeys, m_strPrimaryKey);
            }
            m_createTable = tr("%1 %2").arg(m_createTable, tr("`%1` %2 %3 %4 %5,\n").arg(m_strColName, m_strDataType, m_strNotNull, m_strAutoIncrement, m_strDefault));
        }
    }

    if (ui->txtTableName->text().length() < 1) {
        QMessageBox::warning(this, "Error", "Enter the table name.");
        ui->txtTableName->setFocus();
    }
    else {
        m_createTable = tr("%1 PRIMARY KEY(%2) )Engine=InnoDb;").arg(m_createTable, m_primaryKeys);


        ui->txtQuery->setText(m_createTable);
    }
    isEditing = false;
}
void tableEditor::startEdit ( QString  tableName,
QString  dbName 
)

Definition at line 399 of file tableeditor.cpp.

References addColumn(), db, isEditing, m_originalAutoInc, m_originalDataType, m_originalDefault, m_originalLength, m_originalName, m_originalNotNull, m_originalPrimKey, and saveEditedTable().

                                                             {
    ui->comboBox->setEditText(dbName);
    ui->comboBox->setEnabled(false);
    ui->txtTableName->setText(tableName);
    ui->txtTableName->setEnabled(false);
    isEditing = true;
    QSqlQuery *qu = new QSqlQuery(tr("describe `%1`.`%2`").arg(dbName, tableName), db);
    this->setWindowTitle(tr("Editing table '%1' in '%2' ").arg(tableName, dbName));
    int i = 0;
    int k = 0;
    while (qu->next()) {
        QString m_strColumnName = "";
        QString m_strDataType = "";
        QString m_strLength = "";
        QString m_strNull = "";
        QString m_strKey = "";
        QString m_strDefault = "";
        QString m_strExtra = "";
        m_strColumnName = qu->value(0).toString();
        m_strDataType = qu->value(1).toString();
        m_strNull = qu->value(2).toString();
        m_strKey = qu->value(3).toString();
        m_strDefault = qu->value(4).toString();
        m_strExtra = qu->value(5).toString();
        if (m_strDataType.contains("("))  {
            QStringList list = m_strDataType.split("(");
            m_strDataType = list.at(0);
            m_strLength = list.at(1);
            QStringList len = m_strLength.split(")");
            m_strLength = len.at(0);
        }
        if (m_strExtra.contains("auto")) {
            m_strExtra = "YES";
        }
        if (m_strKey.contains("PRI")) {
            m_strKey = "YES";
        }
        m_strDataType = m_strDataType.toLower();
        //
        m_originalName.insert(k, m_strColumnName);
        m_originalDataType.insert(k, m_strDataType);
        m_originalLength.insert(k, m_strLength);
        m_originalDefault.insert(k, m_strDefault);
        m_originalPrimKey.insert(k, m_strKey);
        m_originalNotNull.insert(k, m_strNull);
        m_originalAutoInc.insert(k, m_strExtra);
        //
        addColumn(m_strColumnName, m_strLength, m_strDataType, m_strNull, m_strExtra, m_strKey, m_strDefault, false, 0);

        i = i + 1;
        k = k + 1;
    }
    saveEditedTable();
}
void tableEditor::updateEdit (  )

Definition at line 628 of file tableeditor.cpp.

References m_originalDefault, m_originalLength, and m_originalName.

                             {
    QColor col = Qt::white;
    for (int j = 0; j < ui->tblColumns->rowCount(); j++) {
        if (j < m_originalName.count()) {
            col = Qt::white;
            QTableWidgetItem *it = ui->tblColumns->item(j, 0);
            //check column name
            if (m_originalName[j] != it->text()) {
                col = Qt::yellow;
            }
            //check length
            it= ui->tblColumns->item(j, 2);
            if (m_originalLength[j] != it->text()) {
                col = Qt::yellow;
            }
            //check default
            it= ui->tblColumns->item(j, 3);
            if (m_originalDefault[j] != it->text()) {
                col = Qt::yellow;
            }
            if (it->backgroundColor() == Qt::red) {
                col = Qt::red;
            } else if (it->backgroundColor() == Qt::lightGray) {
                col = Qt::lightGray;
            }
            for (int k = 0; k < ui->tblColumns->columnCount(); k++) {
                QTableWidgetItem *it = ui->tblColumns->item(j, k);
                it->setBackgroundColor(col);
            }
        }
    }
}

Member Data Documentation

QHash<int, QCheckBox*> tableEditor::autoIncrements

Definition at line 63 of file tableeditor.h.

Referenced by addColumn(), editTable(), generateQuery(), saveEditedTable(), and saveTable().

QHash<int, QComboBox*> tableEditor::dataTypes

Definition at line 64 of file tableeditor.h.

Referenced by addColumn(), editTable(), generateQuery(), saveEditedTable(), and saveTable().

QSqlDatabase tableEditor::db

The database whence all queries run.

Definition at line 27 of file tableeditor.h.

Referenced by loadDatabaseList(), and startEdit().

Icon to be used in the database list combo box.

Definition at line 30 of file tableeditor.h.

If is True, then the widget is in edit mode and will generate an ALTER query. If is False, the widget is in create mode and will generate a CREATE query.

Definition at line 37 of file tableeditor.h.

Referenced by saveTable(), startEdit(), and tableEditor().

QHash<int, QString> tableEditor::m_originalAutoInc

Definition at line 69 of file tableeditor.h.

Referenced by startEdit().

QHash<int, QString> tableEditor::m_originalDataType

Definition at line 71 of file tableeditor.h.

Referenced by startEdit().

QHash<int, QString> tableEditor::m_originalDefault

Definition at line 72 of file tableeditor.h.

Referenced by startEdit(), and updateEdit().

QHash<int, QString> tableEditor::m_originalLength

Definition at line 73 of file tableeditor.h.

Referenced by startEdit(), and updateEdit().

QHash<int, QString> tableEditor::m_originalName

Definition at line 66 of file tableeditor.h.

Referenced by editTable(), generateQuery(), saveEditedTable(), startEdit(), and updateEdit().

QHash<int, QString> tableEditor::m_originalNotNull

Definition at line 68 of file tableeditor.h.

Referenced by startEdit().

QHash<int, QString> tableEditor::m_originalPrimKey

Definition at line 70 of file tableeditor.h.

Referenced by startEdit().

QHash<int, QCheckBox*> tableEditor::notNulls

Definition at line 62 of file tableeditor.h.

Referenced by addColumn(), editTable(), generateQuery(), saveEditedTable(), and saveTable().

QMdiArea* tableEditor::par

Definition at line 76 of file tableeditor.h.

QHash<int, QCheckBox*> tableEditor::primaryKeys

Definition at line 65 of file tableeditor.h.

Referenced by addColumn(), editTable(), generateQuery(), saveEditedTable(), and saveTable().

QHash<int, bool*> tableEditor::toDelete

Definition at line 67 of file tableeditor.h.


The documentation for this class was generated from the following files: