| 12345678910111213141516171819202122232425262728293031 |
- #include "tmodel.h"
- void UserModel::customizeField(const QString &fieldName,
- const QVariant::Type &type,
- const QString &tableName) const
- {
- // QString tableName = "user";
- // const QString columns = "name, swID";
- // QStringList columnList = columns.split(",",
- // Qt::SkipEmptyParts); // 将字符串按逗号分割成列表,跳过空部分
- // for (int i = 0; i < columnList.size(); ++i) {
- // columnList[i] = columnList[i].trimmed(); // 去除每个项的空格
- // }
- // const QString indexName = QString("index_") + tableName + QString("_") + columnList.join("_");
- // CWF::SqlQuery query(storage);
- // QJsonObject json;
- // CWF::SqlQueryManager queryManager(storage);
- // queryManager.createIndex(indexName, tableName, columns, true);
- // QString queryText = queryManager.textQuery(true);
- // query.prepare(queryText);
- // json = query.exec();
- // if (!json.value("success").toBool()) {
- // qDebug() << "ModelBasicOperation::createIndex:"
- // << "Error in index creation for table" << tableName
- // << json.value("message").toString() << query.executedQuery();
- // }
- }
|