Now my appeal to the database looks like this:
QVector<QStringList> VectorOfRecords; QueryConstructor SelectAll; SelectAll.setTableName(QStringLiteral("TableName")); SelectAll.setOrderByClause("Id", Descending); QSqlQuery getRecordsQuery(Database); if( getRecordsQuery.exec(SelectAll.constructSelectQuery())) { while (getRecordsQuery.next()) { QStringList Row; for (int i = 0;i < 9;i++) { Row.push_back(getRecordsQuery.value(i).toString()); } VectorOfRecords.push_back(Row); } } else { QMessageBox::critical(NULL, QObject::tr("Error"), getRecordsQuery.lastError().text()); } QueryConstructor is my class, in this example it is a query to output the entire table.
I want to replace it here
getRecordsQuery.value(i) on appeal not by index, but by name. Because it’s somehow unreliable and unreadable to call on tsiferkam, I think. How can I do that? So it all works, but I want to make a more flexible system.