当前位置: 首页>>代码示例>>C++>>正文


C++ FLTableMetaData::fieldList方法代码示例

本文整理汇总了C++中FLTableMetaData::fieldList方法的典型用法代码示例。如果您正苦于以下问题:C++ FLTableMetaData::fieldList方法的具体用法?C++ FLTableMetaData::fieldList怎么用?C++ FLTableMetaData::fieldList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FLTableMetaData的用法示例。


在下文中一共展示了FLTableMetaData::fieldList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setFromObject

void FLAccessControlTable::setFromObject(QObject *obj)
{
  FLTableMetaData *tm = ::qt_cast<FLTableMetaData *>(obj);
  if (!tm)
    return;

  if (acosPerms_) {
    acosPerms_->clear();
    delete acosPerms_;
  }

  acosPerms_ = new QDict < QString >(31);
  acosPerms_->setAutoDelete(true);

  const FLTableMetaData::FLFieldMetaDataList *fL = tm->fieldList();
  if (!fL)
    return;

  FLFieldMetaData *field;
  QChar permR, permW;
  QDictIterator<FLFieldMetaData> it(*fL);

  while ((field = it.current()) != 0) {
    ++it;
    permR = '-';
    permW = '-';
    if (field->visible())
      permR = 'r';
    if (field->editable())
      permW = 'w';
    acosPerms_->replace(field->name(), new QString(QString(permR) + permW));
  }
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:33,代码来源:FLAccessControlFactory.cpp

示例2: recordInfo

QSqlRecordInfo SqliteDriver::recordInfo(const QString &tablename) const
{
  QSqlRecordInfo info;
  if (!isOpen() || !dataBase_)
    return info;
  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 recordInfo2(tablename);
  }
  docElem = doc.documentElement();
  FLTableMetaData *mtd = db_->manager()->metadata(&docElem, true);
  if (!mtd)
    return recordInfo2(tablename);
  FLTableMetaData::FLFieldMetaDataList *fl = mtd->fieldList();
  if (!fl) {
    delete mtd;
    return recordInfo2(tablename);
  }
  if (fl->isEmpty()) {
    delete mtd;
    return recordInfo2(tablename);
  }

  QStringList fieldsNames = QStringList::split(",", mtd->fieldsNames());
  for (QStringList::Iterator it = fieldsNames.begin(); it != fieldsNames.end(); ++it) {
    FLFieldMetaData *field = mtd->field((*it));
    info.append(QSqlFieldInfo(field->name(), FLFieldMetaData::flDecodeType(field->type())));
  }

  delete mtd;
  return info;
}
开发者ID:gestiweb,项目名称:eneboo,代码行数:38,代码来源:qsqlite.cpp

示例3: setSelect

void FLSqlQuery::setSelect( const QString & s ) {
  d->select_ = s.stripWhiteSpace();
  d->select_ = d->select_.simplifyWhiteSpace();

  QStringList fieldListAux;
  fieldListAux = QStringList::split( ',', s );
  for ( QStringList::Iterator it = fieldListAux.begin(); it != fieldListAux.end(); ++it )
    ( *it ) = ( *it ).stripWhiteSpace();

  QString table, field;
  d->fieldList_.clear();
  for ( QStringList::Iterator it = fieldListAux.begin(); it != fieldListAux.end(); ++it ) {
    table = ( *it ).section( '.', 0, 0 );
    field = ( *it ).section( '.', 1, 1 );
    if ( field == "*" ) {
      FLTableMetaData * mtd = d->db_->manager()->metadata( table, true );
      if ( mtd )
        d->fieldList_ += QStringList::split( ',', mtd->fieldList( true ) );
    } else
      d->fieldList_.append( *it );
  }

  d->select_ = d->fieldList_.join( "," );
}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:24,代码来源:FLSqlQuery.cpp

示例4: processObject

void FLAccessControlTable::processObject(QObject *obj)
{
  if (!obj || obj->aqWasDeleted())
    return;
  FLTableMetaData *tm = ::qt_cast<FLTableMetaData *>(obj);
  if (!tm)
    return;

  int maskPerm = 0;
  bool hasAcos = (acosPerms_ && !acosPerms_->isEmpty());

  if (!perm_.isEmpty()) {
    if (perm_.left(1) == "r")
      maskPerm |= 2;
    if (perm_.right(1) == "w")
      maskPerm |= 1;
  } else if (hasAcos)
    maskPerm = 8;
  else
    return;

  QString fieldPerm;
  QString *fieldPermPtr;
  int maskFieldPerm = 0;

  const FLTableMetaData::FLFieldMetaDataList *fL = tm->fieldList();
  if (!fL)
    return ;

  FLFieldMetaData *field;
  QDictIterator<FLFieldMetaData> it(*fL);

  while ((field = it.current()) != 0) {
    maskFieldPerm = maskPerm;
    ++it;

    if (hasAcos && (fieldPermPtr = (*acosPerms_)[ field->name()])) {
      fieldPerm = *fieldPermPtr;
      maskFieldPerm = 0;

      if (fieldPerm.left(1) == "r")
        maskFieldPerm |= 2;
      if (fieldPerm.right(1) == "w")
        maskFieldPerm |= 1;
    }

    switch (maskFieldPerm) {
      case 0:
        field->setVisible(false);
        field->setEditable(false);
        break;
      case 1:
        field->setVisible(false);
        field->setEditable(true);
        break;
      case 2:
        field->setVisible(true);
        field->setEditable(false);
        break;
      case 3:
        field->setVisible(true);
        field->setEditable(true);
        break;
    }
  }
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:66,代码来源:FLAccessControlFactory.cpp

示例5: 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)
//.........这里部分代码省略.........
开发者ID:gestiweb,项目名称:eneboo,代码行数:101,代码来源:qsqlite.cpp


注:本文中的FLTableMetaData::fieldList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。