tmodel.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. #include "tmodel.h"
  2. void UserModel::customizeField(const QString &fieldName,
  3. const QVariant::Type &type,
  4. const QString &tableName) const
  5. {
  6. // QString tableName = "user";
  7. // const QString columns = "name, swID";
  8. // QStringList columnList = columns.split(",",
  9. // Qt::SkipEmptyParts); // 将字符串按逗号分割成列表,跳过空部分
  10. // for (int i = 0; i < columnList.size(); ++i) {
  11. // columnList[i] = columnList[i].trimmed(); // 去除每个项的空格
  12. // }
  13. // const QString indexName = QString("index_") + tableName + QString("_") + columnList.join("_");
  14. // CWF::SqlQuery query(storage);
  15. // QJsonObject json;
  16. // CWF::SqlQueryManager queryManager(storage);
  17. // queryManager.createIndex(indexName, tableName, columns, true);
  18. // QString queryText = queryManager.textQuery(true);
  19. // query.prepare(queryText);
  20. // json = query.exec();
  21. // if (!json.value("success").toBool()) {
  22. // qDebug() << "ModelBasicOperation::createIndex:"
  23. // << "Error in index creation for table" << tableName
  24. // << json.value("message").toString() << query.executedQuery();
  25. // }
  26. }