void mySqlRelationalDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
    if (!index.isValid())
        return;

    QSqlRelationalTableModel *sqlModel = qobject_cast<QSqlRelationalTableModel *>(model);
    QSortFilterProxyModel* proxyModel = NULL;
    if (!sqlModel )
    {
        proxyModel = qobject_cast<QSortFilterProxyModel *>(model);
        if (proxyModel)
             sqlModel = qobject_cast<QSqlRelationalTableModel *>(proxyModel->sourceModel());
    }

    QSqlTableModel *childModel = sqlModel ? sqlModel->relationModel(index.column()) : 0;
    QComboBox *combo = qobject_cast<QComboBox *>(editor);
    if (!sqlModel || !childModel || !combo) {
        QItemDelegate::setModelData(editor, model, index);
        return;
    }

    int currentItem = combo->currentIndex();
    int childColIndex = childModel->fieldIndex(sqlModel->relation(index.column()).displayColumn());
    int childEditIndex = childModel->fieldIndex(sqlModel->relation(index.column()).indexColumn());


    if (proxyModel) {
        proxyModel->setData(index, childModel->data(childModel->index(currentItem, childColIndex), Qt::DisplayRole), Qt::DisplayRole);
        proxyModel->setData(index, childModel->data(childModel->index(currentItem, childEditIndex), Qt::EditRole), Qt::EditRole);
    } else {
        sqlModel->setData(index, childModel->data(childModel->index(currentItem, childColIndex), Qt::DisplayRole), Qt::DisplayRole);
        sqlModel->setData(index, childModel->data(childModel->index(currentItem, childEditIndex), Qt::EditRole), Qt::EditRole);
    }
}
Esempio n. 2
0
void MainWindow::importData()
{
	int exam_id;
	QString dataFileName = QFileDialog::getOpenFileName(this,tr("Import Data From a CSV File"),QDir::homePath(),tr("CSV File (*.csv)"));
	if(dataFileName.isEmpty())
		return;
	QFile dataFile(dataFileName);
	if(!dataFile.open(QIODevice::ReadOnly))
	{
		QMessageBox::critical(this,tr("Open File Failed"),tr("Cannot open selected file"));;
		return;
	}

	QSqlTableModel* student = m_scoreView->studentListModel();
	QSqlTableModel* exam = m_scoreView->examListModel();
	QSqlRelationalTableModel* score = m_scoreView->scoreListModel();

	QFileInfo tmp(dataFileName);
	QString exam_name = tmp.baseName();
	exam->setFilter(QString("name = \'%1\'").arg(exam_name));
	if(exam->rowCount() == 1)
	{
		QSqlRecord rq = exam->record(0);
		exam_id = rq.value("id").toInt();
	}
	else
	{
		exam->insertRow(0);
		exam->setData(exam->index(0,Global::Exam_Name),exam_name);
		exam->submitAll();
		exam->setFilter(QString("name = \'%1\'").arg(exam_name));
		QSqlRecord rq = exam->record(0);
		exam_id = rq.value("id").toInt();
	}

	QHash<QString,int> studentMap;
	for(int row = 0;row < student->rowCount();++row)
		studentMap.insert(student->data(student->index(row,1)).toString(),student->data(student->index(row,0)).toInt());

	QTextStream in(&dataFile);
	QString record = in.readLine();
	QStringList candidate_seps;
	candidate_seps << ";" << "," << "\t" << " ";
	QString real_sep;
	bool is_legal = false;
	QStringList cols;
	foreach(real_sep, candidate_seps)
	{
		cols = record.split(real_sep);
		if(cols.size() == 11)
		{
			is_legal = true;
			break;
		}
	}
Esempio n. 3
0
void simplePerson::setData(QString idx, QString tableName)
{
    QSqlTableModel model;
    model.setTable(tableName);
    model.setFilter(QString("id = %1").arg(idx));
    model.select();

    id = model.data(model.index(0,0)).toString();
    surname = model.data(model.index(0,1)).toString();
    name = model.data(model.index(0,2)).toString();
    patronimic = model.data(model.index(0,3)).toString();;
}
Esempio n. 4
0
void QSqlQueryModel_snippets()
{
    {
//! [16]
    QSqlQueryModel *model = new QSqlQueryModel;
    model->setQuery("SELECT name, salary FROM employee");
    model->setHeaderData(0, Qt::Horizontal, tr("Name"));
    model->setHeaderData(1, Qt::Horizontal, tr("Salary"));

//! [17]
    QTableView *view = new QTableView;
//! [17] //! [18]
    view->setModel(model);
//! [18] //! [19]
    view->show();
//! [16] //! [19] //! [20]
    view->setEditTriggers(QAbstractItemView::NoEditTriggers);
//! [20]
    }

//! [21]
    QSqlTableModel model;
    model.setTable("employee");
    model.select();
    int salary = model.record(4).value("salary").toInt();
//! [21]
    Q_UNUSED(salary);

    {
//! [22]
    int salary = model.data(model.index(4, 2)).toInt();
//! [22]
    Q_UNUSED(salary);
    }

    for (int row = 0; row < model.rowCount(); ++row) {
        for (int col = 0; col < model.columnCount(); ++col) {
            qDebug() << model.data(model.index(row, col));
        }
    }
}
Esempio n. 5
0
int FacturationIO::getrowoffacturation(QSqlTableModel & modelfacturation,const QString & factureid)
{
    int row = 0;
    for ( int i = 0; i < modelfacturation.rowCount(); ++i)
    {
        if (modelfacturation.data(modelfacturation.index(i,ID_FACTURE),Qt::DisplayRole).toString() == factureid)
        {
              row = i;
            }
        }
    return row;
}
Esempio n. 6
0
void MySqlRelationDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
    if (!index.isValid())
        return;

    QSqlRelationalTableModel *sqlModel = qobject_cast<QSqlRelationalTableModel *>(model);
    QSqlTableModel *childModel = sqlModel ? sqlModel->relationModel(index.column()) : 0;
    QComboBox *combo = qobject_cast<QComboBox *>(editor);
    if (!sqlModel || !childModel || !combo) {
        if (HandbookDialog::m_record.fieldName(index.column()).contains("IS_", Qt::CaseSensitive))
        {
            QCheckBox * checkBox = qobject_cast<QCheckBox *>(editor);
            sqlModel->setData(index, checkBox->isChecked(), Qt::DisplayRole);
            sqlModel->setData(index, checkBox->isChecked(), Qt::EditRole);
            return;
        }
        else if (HandbookDialog::m_record.fieldName(index.column()).contains("DATE_", Qt::CaseSensitive))
        {
            QDateEdit * dateEdit = qobject_cast<QDateEdit *>(editor);
            sqlModel->setData(index, dateEdit->date().toString("yyyy-MM-dd"), Qt::DisplayRole);
            sqlModel->setData(index, dateEdit->date().toString("yyyy-MM-dd"), Qt::EditRole);
            return;
        }
        else
        {
            QItemDelegate::setModelData(editor, model, index);
            return;
        }
    }

    int currentItem = combo->currentIndex();
    int childColIndex = childModel->fieldIndex(sqlModel->relation(index.column()).displayColumn());
    int childEditIndex = childModel->fieldIndex(sqlModel->relation(index.column()).indexColumn());
    sqlModel->setData(index,
            childModel->data(childModel->index(currentItem, childColIndex), Qt::DisplayRole),
            Qt::DisplayRole);
    sqlModel->setData(index,
            childModel->data(childModel->index(currentItem, childEditIndex), Qt::EditRole),
            Qt::EditRole);
}
Esempio n. 7
0
void MainWindow::on_currencyComboBox_currentIndexChanged(int index)
{
    int row = ui->assetsTable->currentIndex().row();
    QVariant current_value = model->data(model->index(row, currency_column_index), Qt::DisplayRole);

    QSqlTableModel *childModel = model->relationModel(currency_column_index);
    int childColIndex = childModel->fieldIndex("code");
    QVariant new_value = childModel->data(childModel->index(index, childColIndex), Qt::DisplayRole);

    if(current_value != new_value) {
        mapper->submit();
    }
}
Esempio n. 8
0
void partner::setUpdate(QString idt)
{
	QSqlTableModel model;
	model.setTable("Partner");
	model.setFilter(QString("id = %1").arg(idt));
	model.select();
	id = model.data(model.index(0,0)).toInt();
	ui->nameEdit->setText(model.data(model.index(0,1)).toString());
	ui->surnameEdit->setText(model.data(model.index(0,2)).toString());
	ui->patronimicEdit->setText(model.data(model.index(0,3)).toString());
	ui->passportEdit->setText(model.data(model.index(0,4)).toString());
	ui->phoneEdit->setText(model.data(model.index(0,5)).toString());
	mode = updateMode;
}
Esempio n. 9
0
void SelectLiftDlg::on_pushBtnSel_clicked()
{
    int curRow = ui->tableView->currentIndex().row();
    if(curRow<0)
    {
        QMessageBox::warning(this,"警告","请先选择电梯!",QMessageBox::Yes);
        return;
    }
    QSqlTableModel *modelTable = new QSqlTableModel(this);
    modelTable->setTable("tableLift");
    modelTable->select();

    for(int i=0;i<modelTable->columnCount();i++)
    {
        QModelIndex index = modelTable->index(curRow,i);
        arrValues.push_back(modelTable->data(index).toString());
    }

    accept();
}
Esempio n. 10
0
void MainWindow::slotBtnReadCard()
{  
    std::string strTxtbrwInfos = "";
    QString strQTxtbrwInfos;
#ifdef USE_CH375
    if(ch375rw.bIsOpened)
    {
        ch375rw.Read(0x00,48);
        Sleep(TIME_DELAY);
        UCHAR *chData = ch375rw.Read(0x00,48);
        if(chData==NULL)
        {
            return;
        }
        strTxtbrwInfos = "卡号:"+ch375rw.strCardID+"\n";
        switch(int(chData[1]))//卡类型
        {
        case 0x01://用户卡
        {
            strTxtbrwInfos += "卡类型:用户卡\n";
            dsUserCard.chars2DS(chData);

            break;
        }
        case 0x2://普通管理人卡
            strTxtbrwInfos += "卡类型:普通管理人卡\n";
            break;
        case 0x3://高级管理人卡
            strTxtbrwInfos += "卡类型:高级管理人卡\n";
            break;
        case 0x04://黑名单(启禁用卡)
        {
            strTxtbrwInfos += "卡类型:启禁用卡\n";
            dsEnableCard.chars2DS(chData);
            if(dsEnableCard.structEnableCard.EnableType==0x01)//按卡号
            {
                strTxtbrwInfos += "启禁用类型:按卡号\n";
            }
            if(dsEnableCard.structEnableCard.EnableType==0x02)//按房号
            {
                strTxtbrwInfos += "启禁用类型:按房号\n";
            }
            std::string strLimitCardType="";
            if(dsEnableCard.structEnableCard.LimitCardType==0x01)
            {
                strLimitCardType="用户卡";
            }
            if(dsEnableCard.structEnableCard.LimitCardType==0x02)
            {
                strLimitCardType="管理人卡";
            }
            int nLiftNum = dsEnableCard.structEnableCard.LiftNum;
            strTxtbrwInfos +=
                "可用电梯:"+TypeConvert::intNormal2stdstring(nLiftNum)+"\n";
            if(dsEnableCard.structEnableCard.Num1[0]==0x00)
            {
                std::string strIsEnable1="";
                if(dsEnableCard.structEnableCard.IsEnable1==0x01)
                {
                    strIsEnable1="启用";
                }
                if(dsEnableCard.structEnableCard.IsEnable1==0x02)
                {
                    strIsEnable1="禁用";
                }
                std::string strNum1="";
                for(int i=0;i<4;i++)
                {
                    int nNum1=dsEnableCard.structEnableCard.Num1[i];
                    strNum1 += TypeConvert::intDec2stdstring(nNum1);
                }
                if(dsEnableCard.structEnableCard.EnableType==0x01)
                {
                    strTxtbrwInfos +=
                            strLimitCardType+"卡号:"+
                            strNum1.substr(3,5)+" "+strIsEnable1+"\n";
                }
                if(dsEnableCard.structEnableCard.EnableType==0x02)
                {
                    strTxtbrwInfos +=
                            "房号:"+strNum1.substr(4,4)+" "+strIsEnable1+"\n";
                }
            }
            if(dsEnableCard.structEnableCard.Num2[0]==0x00)
            {
                std::string strIsEnable2="";
                if(dsEnableCard.structEnableCard.IsEnable2==0x01)
                {
                    strIsEnable2="启用";
                }
                if(dsEnableCard.structEnableCard.IsEnable2==0x02)
                {
                    strIsEnable2="禁用";
                }
                std::string strNum2="";
                for(int i=0;i<4;i++)
                {
                    int nNum2=dsEnableCard.structEnableCard.Num2[i];
                    strNum2 += TypeConvert::intDec2stdstring(nNum2);
                }
                if(dsEnableCard.structEnableCard.EnableType==0x01)
                {
                    strTxtbrwInfos +=
                            strLimitCardType+"卡号:"+
                            strNum2.substr(3,5)+" "+strIsEnable2+"\n";
                }
                if(dsEnableCard.structEnableCard.EnableType==0x02)
                {
                    strTxtbrwInfos +=
                            "房号:"+strNum2.substr(4,4)+" "+strIsEnable2+"\n";
                }
            }
            if(dsEnableCard.structEnableCard.Num3[0]==0x00)
            {
                std::string strIsEnable3="";
                if(dsEnableCard.structEnableCard.IsEnable3==0x01)
                {
                    strIsEnable3="启用";
                }
                if(dsEnableCard.structEnableCard.IsEnable3==0x02)
                {
                    strIsEnable3="禁用";
                }
                std::string strNum3="";
                for(int i=0;i<4;i++)
                {
                    int nNum3=dsEnableCard.structEnableCard.Num3[i];
                    strNum3 += TypeConvert::intDec2stdstring(nNum3);
                }
                if(dsEnableCard.structEnableCard.EnableType==0x01)
                {
                    strTxtbrwInfos +=
                            strLimitCardType+"卡号:"+
                            strNum3.substr(3,5)+" "+strIsEnable3+"\n";
                }
                if(dsEnableCard.structEnableCard.EnableType==0x02)
                {
                    strTxtbrwInfos +=
                            "房号:"+strNum3.substr(4,4)+" "+strIsEnable3+"\n";
                }
            }
            if(dsEnableCard.structEnableCard.Num4[0]==0x00)
            {
                std::string strIsEnable4="";
                if(dsEnableCard.structEnableCard.IsEnable4==0x01)
                {
                    strIsEnable4="启用";
                }
                if(dsEnableCard.structEnableCard.IsEnable4==0x02)
                {
                    strIsEnable4="禁用";
                }
                std::string strNum4="";
                for(int i=0;i<4;i++)
                {
                    int nNum4=dsEnableCard.structEnableCard.Num4[i];
                    strNum4 += TypeConvert::intDec2stdstring(nNum4);
                }
                if(dsEnableCard.structEnableCard.EnableType==0x01)
                {
                    strTxtbrwInfos +=
                            strLimitCardType+"卡号:"+
                            strNum4.substr(3,5)+" "+strIsEnable4+"\n";
                }
                if(dsEnableCard.structEnableCard.EnableType==0x02)
                {
                    strTxtbrwInfos +=
                            "房号:"+strNum4.substr(4,4)+" "+strIsEnable4+"\n";
                }
            }
            break;
        }
        case 0x06://时间矫正卡
        {
            strTxtbrwInfos += "卡类型:时间矫正卡\n";
            dsTimeSet.chars2DS(chData);
            switch(dsTimeSet.structTimeSet.TimeSetType)
            {
            case SetType::SetControlerTime:
            {
                strTxtbrwInfos += "时间卡功能:控制器时间设置\n";               
                std::vector<std::string> vectorDateTime;
                for(int i=0;i<6;i++)
                {
                    int nTemp=dsTimeSet.structTimeSet.ControlerTime[i];
                    vectorDateTime.push_back(TypeConvert::intHex2stdstring(nTemp));
                }
                std::string strDateTime =
                        vectorDateTime[0]+    vectorDateTime[1]+"-"+
                        vectorDateTime[2]+"-"+vectorDateTime[3]+" "+
                        vectorDateTime[4]+":"+vectorDateTime[5];
                strTxtbrwInfos += "控制器时间:"+strDateTime+"\n";
                break;
            }
            case SetType::SetKeyResponseTime:
            {
                strTxtbrwInfos += "时间卡功能:按钮响应时间设置\n";
                float fTimeOne=
                        float(dsTimeSet.structTimeSet.SingleSelectTime)/10;
                short sTimeMul=dsTimeSet.structTimeSet.MultiSelectTime;
                std::string strTimeOne=TypeConvert::float2stdstring(fTimeOne);
                std::string strTimeMul=TypeConvert::intDec2stdstring(sTimeMul);
                strTxtbrwInfos +=
                        "单选按键响应时间:"+strTimeOne+"秒\n"+
                        "多选按键响应时间:"+strTimeMul+"秒\n";
                break;
            }
            case SetType::SetVisitorResponseTime:
            {
                strTxtbrwInfos += "时间卡功能:访客按钮响应时间设置\n";
                int nHI=dsTimeSet.structTimeSet.VisitorTime[0];
                int nLO=dsTimeSet.structTimeSet.VisitorTime[1];
                int nTimeVisit=nHI*256+nLO;
                std::string strTimeVisit =
                        TypeConvert::intNormal2stdstring(nTimeVisit);
                strTxtbrwInfos +=
                        "访客按键响应时间:"+strTimeVisit+"秒\n";
                break;
            }
            }
            break;
        }
        case 0x7://电梯运行卡
        {
            strTxtbrwInfos += "卡类型:电梯运行卡\n";
            break;
        }
        case 0x08://系统开关卡
        {
            strTxtbrwInfos += "卡类型:系统开关卡\n";
            dsSysSwitchCard.chars2DS(chData);
            switch (dsSysSwitchCard.structSysSwitchCard.SwitchCardType)
            {
            case SWCardType::SysSwitch:
            {
                strTxtbrwInfos+="开关卡分类:系统开关卡\n";
                break;
            }
            case SWCardType::LayerSwitch:
            {
                strTxtbrwInfos+="开关卡分类:分层开关卡\n";
                if(dsSysSwitchCard.structSysSwitchCard.SwitchFlag==0x11)
                {
                    strTxtbrwInfos+="开关标识:开放\n";
                }
                if(dsSysSwitchCard.structSysSwitchCard.SwitchFlag==0x22)
                {
                    strTxtbrwInfos+="开关标识:关闭\n";
                }
                //电梯编号
                int nLiftNum=0;
                for(int i=0;i<32;i++)
                {
                    for(int j=0;j<8;j++)
                    {
                        if
                        (
                        (dsSysSwitchCard.structSysSwitchCard.LiftNum[i] & (1<<j)) == pow(2,j)
                        )
                        {
                            nLiftNum=i*8+(j+1);
                            break;
                        }
                    }
                }
                strTxtbrwInfos+="可用电梯号:"+TypeConvert::intNormal2stdstring(nLiftNum)+"\n";
                //受控楼层
                strTxtbrwInfos+="受控楼层:";
                strTxtbrwInfos+="A门:";
                for(int i=0;i<6;i++)
                {
                    for(int j=0;j<8;j++)
                    {
                        if
                        (
                        (dsSysSwitchCard.structSysSwitchCard.FloorsA[i]&(1<<j)) == pow(2,j)
                        )
                        {
                            int nFloor = i*8+(j+1);
                            strTxtbrwInfos+=TypeConvert::intNormal2stdstring(nFloor)+",";
                        }
                    }
                }
                strTxtbrwInfos.erase(strTxtbrwInfos.end()-1);
                strTxtbrwInfos+="\n";
                break;
            }
            case SWCardType::PublicFloorsSet:
            {
                strTxtbrwInfos+="开关卡分类:公共楼层设置卡\n";
                if(dsSysSwitchCard.structSysSwitchCard.SwitchFlag==0x11)
                {
                    strTxtbrwInfos+="开关标识:开放\n";
                }
                if(dsSysSwitchCard.structSysSwitchCard.SwitchFlag==0x22)
                {
                    strTxtbrwInfos+="开关标识:关闭\n";
                }
                //电梯编号
                int nLiftNum=1;
                for(int i=0;i<32;i++)
                {
                    for(int j=0;j<8;j++)
                    {
                        if
                        (
                        (dsSysSwitchCard.structSysSwitchCard.LiftNum[i]&(1<<j)) == pow(2,j)
                        )
                        {
                            nLiftNum=i*8+(j+1);
                        }
                    }
                }
                strTxtbrwInfos+="可用电梯号:"+TypeConvert::intNormal2stdstring(nLiftNum)+"\n";
                //受控楼层
                strTxtbrwInfos+="受控楼层:";
                strTxtbrwInfos+="A门:";
                for(int i=0;i<6;i++)
                {
                    for(int j=0;j<8;j++)
                    {
                        if
                        (
                        (dsSysSwitchCard.structSysSwitchCard.FloorsA[i]&(1<<j)) == pow(2,j)
                        )
                        {
                            int nFloor = i*8+(j+1);
                            strTxtbrwInfos+=TypeConvert::intNormal2stdstring(nFloor)+",";
                        }
                    }
                }
                strTxtbrwInfos.erase(strTxtbrwInfos.end()-1);
                strTxtbrwInfos+="\n";
                break;
            }
            default:
                break;
            }
            break;
        }
        case 0x0A://通讯地址设定卡
        {
            strTxtbrwInfos += "卡类型:通讯地址设定卡\n";
            int nAddr = chData[2];
            strTxtbrwInfos +=
                    "地址:"+TypeConvert::intNormal2stdstring(nAddr)+"\n";
            break;
        }
        case 0x0B://清内存卡
        {
            strTxtbrwInfos += "卡类型:清内存卡\n";
            break;
        }     
        default:
        {
            strTxtbrwInfos += "此卡为新卡\n";
            break;
        }
        }
    }
    else
    {
        strTxtbrwInfos = "请插入读卡器!";
    }
    ch375rw.Beep(1);
    strQTxtbrwInfos=QString::fromStdString(strTxtbrwInfos);
#endif

    static int countClick=0;
    countClick++;
    switch(countClick)
    {
    case 1:
    {
        strQTxtbrwInfos="用户卡\n";
        std::vector<QString> arrFiledsUsrCards;
        arrFiledsUsrCards.push_back("卡号");
        arrFiledsUsrCards.push_back("业主姓名");
        arrFiledsUsrCards.push_back("业主门牌");
        arrFiledsUsrCards.push_back("联系电话");
        arrFiledsUsrCards.push_back("限制日期");
        arrFiledsUsrCards.push_back("可用电梯");
        arrFiledsUsrCards.push_back("可用楼层");
        arrFiledsUsrCards.push_back("房间编号");

        QSqlTableModel *modelTableUsrCard = new QSqlTableModel(this);
        modelTableUsrCard->setTable("tableUsrCard");
        modelTableUsrCard->select();
        int rowLast = modelTableUsrCard->rowCount()-1;
        for(int i=0;i<8;i++)
        {
            QModelIndex indexModelLast = modelTableUsrCard->index(rowLast,i);
            QString strUsrCardLast = modelTableUsrCard->data(indexModelLast).toString();
            strQTxtbrwInfos += arrFiledsUsrCards[i] + ":"+strUsrCardLast+"\n";
        }
        break;
    }
    case 2:
    {
        strQTxtbrwInfos="此卡为新卡!\n";
        break;
    }
    }

    txtbrwInfos->setText(strQTxtbrwInfos);
}
void TableEditor::removeSelectedRows()
{
    int currentTab = tabWidget->currentIndex();
    QTableView *tv = agentsTable;
    QSqlTableModel *stm = agentsModel;
    QString table = "agents";
    int idColumn = 0;
    if (currentTab == 1)
    {
        tv = determinationsTable;
        stm = determinationsModel;
        table = "determinations";
    }
    else if (currentTab == 2)
    {
        tv = imagesTable;
        stm = imagesModel;
        table = "images";
        idColumn = 20;
    }
    else if (currentTab == 3)
    {
        tv = taxaTable;
        stm = taxaModel;
        table = "taxa";
        idColumn = 1;
    }
    else if (currentTab == 4)
    {
        tv = organismsTable;
        stm = organismsModel;
        table = "organisms";
    }
    else if (currentTab == 5)
    {
        tv = sensuTable;
        stm = sensuModel;
        table = "sensu";
    }
    QItemSelectionModel *selected = tv->selectionModel();
    QModelIndexList rowList = selected->selectedIndexes();

    for (int i = rowList.count()-1; i >= 0; i--)
    {
        stm->removeRow(rowList.at(i).row(), rowList.at(i).parent());
        QString identifier;
        if (table == "determinations")
        {
            QString orgID = stm->data(stm->index(rowList.at(i).row(),0),Qt::DisplayRole).toString();
            QString date = stm->data(stm->index(rowList.at(i).row(),2),Qt::DisplayRole).toString();
            QString tsnID = stm->data(stm->index(rowList.at(i).row(),4),Qt::DisplayRole).toString();
            QString source = stm->data(stm->index(rowList.at(i).row(),5),Qt::DisplayRole).toString();
            reversions.append("INSERT OR REPLACE INTO determinations SELECT * FROM pub_determinations "
                              "WHERE dsw_identified = '" + orgID + "' AND "
                              "dwc_dateIdentified = '" + date + "' AND "
                              "tsnID = '" + tsnID + "' AND "
                              "nameAccordingToID = '" + source + "' LIMIT 1");

        }
        else
        {
            identifier = stm->data(stm->index(rowList.at(i).row(),idColumn),Qt::DisplayRole).toString();
            reversions.append("INSERT OR REPLACE INTO " + table + " SELECT * FROM pub_" + table + " WHERE dcterms_identifier = '" + identifier + "' LIMIT 1");
        }
    }
}