本文整理汇总了C++中FLFieldMetaData::defaultValue方法的典型用法代码示例。如果您正苦于以下问题:C++ FLFieldMetaData::defaultValue方法的具体用法?C++ FLFieldMetaData::defaultValue怎么用?C++ FLFieldMetaData::defaultValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FLFieldMetaData
的用法示例。
在下文中一共展示了FLFieldMetaData::defaultValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: alterTable
//.........这里部分代码省略.........
db_->dbAux() ->rollback();
if ((oldMTD != newMTD) && oldMTD)
delete oldMTD;
if (newMTD)
delete newMTD;
return false;
}
if (fieldList->isEmpty()) {
#ifdef FL_DEBUG
qWarning("FLManager::alterTable : " + QApplication::tr("Los nuevos metadatos no tienen campos."));
#endif
db_->dbAux() ->rollback();
if ((oldMTD != newMTD) && oldMTD)
delete oldMTD;
if (newMTD)
delete newMTD;
return false;
}
QVariant v;
bool ok = true;
while (oldCursor.next()) {
newBuffer = newCursor.primeInsert();
QDictIterator<FLFieldMetaData> it(*fieldList);
while ((newField = it.current()) != 0) {
++it;
oldField = oldMTD->field(newField->name());
if (!oldField || !oldCursor.field(oldField->name())) {
if (!oldField)
oldField = newField;
v = newField->defaultValue();
v.cast(FLFieldMetaData::flDecodeType(newField->type()));
} else {
v = oldCursor.value(newField->name());
if ((!oldField->allowNull() || !newField->allowNull()) &&
(v.isNull() || !v.isValid())) {
QVariant defVal(newField->defaultValue());
if (!defVal.isNull() && defVal.isValid())
v = defVal;
}
if (!v.cast(newBuffer->value(newField->name()).type())) {
#ifdef FL_DEBUG
qWarning("FLManager::alterTable : " +
QApplication::tr("Los tipos del campo %1 no son compatibles. Se introducirá un valor nulo.")
.arg(newField->name()));
#endif
}
}
if ((!oldField->allowNull() || !newField->allowNull()) && (v.isNull() || !v.isValid())) {
switch (oldField->type()) {
case QVariant::Int:
case FLFieldMetaData::Serial:
case QVariant::UInt:
case QVariant::Bool:
case FLFieldMetaData::Unlock:
v = int(0);
break;
case QVariant::Double:
v = double(0.0);
break;
case QVariant::Time:
v = QTime::currentTime();
break;