本文整理汇总了C++中FLTableMetaData::fieldType方法的典型用法代码示例。如果您正苦于以下问题:C++ FLTableMetaData::fieldType方法的具体用法?C++ FLTableMetaData::fieldType怎么用?C++ FLTableMetaData::fieldType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FLTableMetaData
的用法示例。
在下文中一共展示了FLTableMetaData::fieldType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: primaryIndex
QSqlIndex SqliteDriver::primaryIndex(const QString &tablename) const
{
QSqlIndex idx(tablename);
if (!isOpen() || !dataBase_)
return idx;
QDomDocument doc(tablename);
QDomElement docElem;
QString stream = db_->managerModules()->contentCached(tablename + ".mtd");
if (!FLUtil::domDocumentSetContent(doc, stream)) {
#ifdef FL_DEBUG
qWarning("FLManager : " + QApplication::tr("Error al cargar los metadatos para la tabla %1").arg(tablename));
#endif
return primaryIndex2(tablename);
}
docElem = doc.documentElement();
FLTableMetaData *mtd = db_->manager()->metadata(&docElem, true);
if (!mtd)
return primaryIndex2(tablename);
idx.append(QSqlField(mtd->primaryKey(), FLFieldMetaData::flDecodeType(mtd->fieldType(mtd->primaryKey()))));
idx.setName(tablename.lower() + "_pkey");
delete mtd;
return idx;
}
示例2: record
QSqlRecord SqliteDriver::record(const QString &tablename) const
{
QSqlRecord fil;
if (!isOpen() || !dataBase_)
return fil;
QDomDocument doc(tablename);
QDomElement docElem;
QString stream = db_->managerModules()->contentCached(tablename + ".mtd");
if (!FLUtil::domDocumentSetContent(doc, stream)) {
#ifdef FL_DEBUG
qWarning("FLManager : " + QApplication::tr("Error al cargar los metadatos para la tabla %1").arg(tablename));
#endif
return record2(tablename);
}
docElem = doc.documentElement();
FLTableMetaData *mtd = db_->manager()->metadata(&docElem, true);
if (!mtd)
return record2(tablename);
FLTableMetaData::FLFieldMetaDataList *fl = mtd->fieldList();
if (!fl) {
delete mtd;
return record2(tablename);
}
if (fl->isEmpty()) {
delete mtd;
return record2(tablename);
}
QStringList fieldsNames = QStringList::split(",", mtd->fieldsNames());
for (QStringList::Iterator it = fieldsNames.begin(); it != fieldsNames.end(); ++it)
fil.append(QSqlField((*it), FLFieldMetaData::flDecodeType(mtd->fieldType((*it)))));
delete mtd;
return fil;
}
示例3: alterTable
bool SqliteDriver::alterTable(const QString &mtd1, const QString &mtd2, const QString &key)
{
#ifndef FL_QUICK_CLIENT
FLTableMetaData *oldMTD = 0;
FLTableMetaData *newMTD = 0;
QDomDocument doc("doc");
QDomElement docElem;
if (!FLUtil::domDocumentSetContent(doc, mtd1)) {
#ifdef FL_DEBUG
qWarning("FLManager::alterTable : " + QApplication::tr("Error al cargar los metadatos."));
#endif
} else {
docElem = doc.documentElement();
oldMTD = db_->manager()->metadata(&docElem, true);
}
if (oldMTD && oldMTD->isQuery())
return true;
if (!FLUtil::domDocumentSetContent(doc, mtd2)) {
#ifdef FL_DEBUG
qWarning("FLManager::alterTable : " + QApplication::tr("Error al cargar los metadatos."));
#endif
return false;
} else {
docElem = doc.documentElement();
newMTD = db_->manager()->metadata(&docElem, true);
}
if (!oldMTD)
oldMTD = newMTD;
if (oldMTD->name() != newMTD->name()) {
#ifdef FL_DEBUG
qWarning("FLManager::alterTable : " + QApplication::tr("Los nombres de las tablas nueva y vieja difieren."));
#endif
if ((oldMTD != newMTD) && oldMTD)
delete oldMTD;
if (newMTD)
delete newMTD;
return false;
}
QString oldPK = oldMTD->primaryKey(), newPK = newMTD->primaryKey();
if (oldPK != newPK) {
#ifdef FL_DEBUG
qWarning("FLManager::alterTable : " + QApplication::tr("Los nombres de las claves primarias difieren."));
#endif
if ((oldMTD != newMTD) && oldMTD)
delete oldMTD;
if (newMTD)
delete newMTD;
return false;
}
if (oldMTD->fieldType(oldPK) != newMTD->fieldType(newPK)) {
#ifdef FL_DEBUG
qWarning("FLManager::alterTable : " + QApplication::tr("Los tipos de las claves primarias difieren."));
#endif
if ((oldMTD != newMTD) && oldMTD)
delete oldMTD;
if (newMTD)
delete newMTD;
return false;
}
if (db_->manager()->checkMetaData(oldMTD, newMTD)) {
if ((oldMTD != newMTD) && oldMTD)
delete oldMTD;
if (newMTD)
delete newMTD;
return true;
}
if (!db_->manager()->existsTable(oldMTD->name())) {
#ifdef FL_DEBUG
qWarning("FLManager::alterTable : " + QApplication::tr("La tabla %1 antigua de donde importar los registros no existe.").arg(oldMTD->name()));
#endif
if ((oldMTD != newMTD) && oldMTD)
delete oldMTD;
if (newMTD)
delete newMTD;
return false;
}
FLTableMetaData::FLFieldMetaDataList *fieldList = oldMTD->fieldList();
FLFieldMetaData *oldField = 0;
if (!fieldList) {
#ifdef FL_DEBUG
qWarning("FLManager::alterTable : " + QApplication::tr("Los antiguos metadatos no tienen campos."));
#endif
if ((oldMTD != newMTD) && oldMTD)
//.........这里部分代码省略.........