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


C++ QSqlRecord::isEmpty方法代码示例

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


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

示例1: nextRecord

int qtDatabase::nextRecord()
{
  result->next();
  QSqlRecord record = result->record();
  if(record.isEmpty()) return -1;
  return 0;
}
开发者ID:nrj123,项目名称:pvb,代码行数:7,代码来源:qtdatabase.cpp

示例2: insert

//start id="insert"
bool MetaDataTable::insert(const MetaDataValue &ft) {
    using namespace DbUtils;

    QSqlDatabase db = DbConnectionSettings::lastSaved();
    QSqlRecord record = db.record(m_tableName);
    if (record.isEmpty() && !createMetadataTable()) {
        qDebug() << "unable to create metadata: " 
                 << db.lastError().text();
        return false;
    }

    m_insertQuery.bindValue(":artist", ft.artist());
    m_insertQuery.bindValue(":title", ft.trackTitle());
    m_insertQuery.bindValue(":album", ft.albumTitle());
    m_insertQuery.bindValue(":track", ft.trackNumber());
    QTime t = ft.trackTime();
    int secs = QTime().secsTo(t);
    m_insertQuery.bindValue(":time", secs);
    m_insertQuery.bindValue(":genre", ft.genre());
    m_insertQuery.bindValue(":filename", ft.fileName());
    int pref = ft.preference().intValue();
    m_insertQuery.bindValue(":preference", pref);
    m_insertQuery.bindValue(":comment", ft.comment());

    bool retval = m_insertQuery.exec();

    if (!retval) {
        qDebug() << m_insertQuery.lastError().text() 
                 << m_insertQuery.lastQuery();
        abort();
    }
    emit inserted(ft);
    return retval;
}
开发者ID:FlavioFalcao,项目名称:Intro-Design-Patterns-Cpp-Qt5,代码行数:35,代码来源:metadatatable.cpp

示例3: update

	void update(QSqlDatabase* db, Tag& tag) {
		QSqlQuery q(*db);
		QSqlRecord r;

		if(!QItem::isExists(db, "tags", "guid", QString::fromStdString(tag.guid), r))
		{
			r = QItem::load(db, "tags", "name", QString::fromUtf8(tag.name.c_str()));
			if(!r.isEmpty())
			{
				tag.name = QItem::resolveConflict(db, r, QString::fromStdString(tag.guid), DELETE_ITEM("tags", "guid", QString::fromStdString(tag.guid)), tag.name);
			}

			q.prepare(INSERT_TAG(tag.guid, tag.name, tag.parentGuid, tag.updateSequenceNum));
		}
		else if(r.value("updateSequenceNum").toInt() < tag.updateSequenceNum)
		{
			qDebug() << r.value("updateSequenceNum").toInt() << r;
			// update tag
			q.prepare(UPDATE_TAG(tag.guid, tag.name, tag.parentGuid, tag.updateSequenceNum));
		}
		else
			return;

		QItem::executeQuery(q);
	}
开发者ID:cas--,项目名称:Qvernote,代码行数:25,代码来源:QTag.cpp

示例4: isEmpty

bool QSqlRecordProto::isEmpty() const
{
  QSqlRecord *item = qscriptvalue_cast<QSqlRecord*>(thisObject());
  if (item)
    return item->isEmpty();
  return false;
}
开发者ID:ChristopherCotnoir,项目名称:qt-client,代码行数:7,代码来源:qsqlrecordproto.cpp

示例5: insertRowIntoTable

bool PoitemTableModel::insertRowIntoTable(const QSqlRecord& record)
{
  if (record.isEmpty())
    return true;

  bool isNull = true;
  for (int i = 0; i < record.count(); i++)
  {
    if (i == record.indexOf("poitem_pohead_id") ||
	(record.value(i).toString().isEmpty() &&
	  (i == record.indexOf("poitem_status") ||
	   i == record.indexOf("poitem_vend_item_descrip") ||
	   i == record.indexOf("poitem_vend_uom") ||
	   i == record.indexOf("poitem_vend_item_number") ||
	   i == record.indexOf("poitem_comments") )))
      continue;
    isNull &= record.isNull(i);
  }
  if (isNull)
    return true;

  QSqlRecord newRecord(record);
  if (! validRow(newRecord))
    return false;

  return QSqlRelationalTableModel::insertRowIntoTable(newRecord);
}
开发者ID:ChristopherCotnoir,项目名称:qt-client,代码行数:27,代码来源:poitemTableModel.cpp

示例6: readProtoBufferFromDatabase

/**
 * @brief cwRegionLoadTask::readProtoBufferFromDatabase
 * @return This reads the proto buffer from the database
 */
QByteArray cwRegionLoadTask::readProtoBufferFromDatabase(bool* okay)
{
    cwSQLManager::Transaction transaction(&Database, cwSQLManager::ReadOnly);

    QSqlQuery selectObjectData(Database);
    QString queryStr =
        QString("SELECT protoBuffer FROM ObjectData where id = 1");

    bool couldPrepare = selectObjectData.prepare(queryStr);
    if(!couldPrepare) {
        qDebug() << "Couldn't prepare select Caving Region:" << selectObjectData.lastError().databaseText() << queryStr;
    }

    //Extract the data
    selectObjectData.exec();
    QSqlRecord record = selectObjectData.record();

    if(record.isEmpty()) {
        qDebug() << "Hmmmm, no caving regions to load from protoBuffer";
        *okay = false;
        return QByteArray();
    }

    //Get the first row
    selectObjectData.next();

    *okay = true;
    QByteArray data = selectObjectData.value(0).toByteArray();
    return data;
}
开发者ID:Cavewhere,项目名称:cavewhere,代码行数:34,代码来源:cwRegionLoadTask.cpp

示例7: count

int XSqlQuery::count()
{
  QSqlRecord rec = record();

  if (!rec.isEmpty())
    return rec.count();
  else
    return 0;
}
开发者ID:0TheFox0,项目名称:MayaOpenRPT,代码行数:9,代码来源:xsqlquery.cpp

示例8: setItem

void Scrap::setItem(const QSqlRecord &record)
{
    if(!record.isEmpty()){
        ui->number_lineEdit->setText(record.value("number").toString());
        ui->operator_lineEdit->setText(record.value("name").toString());
        ui->type_lineEdit->setText(record.value("type").toString());
        ui->manufacturer_lineEdit->setText(record.value("manufacturer").toString());
    }
}
开发者ID:firemariovn,项目名称:qt-inventory,代码行数:9,代码来源:scrap.cpp

示例9: QStringList

int
QcOfflineCacheDatabase::has_tile(const QcTileSpec & tile_spec)
{
  QSqlRecord record = select_one(TILE, QStringList(OFFLINE_COUNT), tile_where_clause(tile_spec));
  if (record.isEmpty())
    return 0;
  else
    return record.value(0).toInt();
}
开发者ID:FabriceSalvaire,项目名称:qtcarto,代码行数:9,代码来源:offline_cache_database.cpp

示例10: count

int XSqlQuery::count()
{
  QSqlRecord record = driver()->record(*this);

  if (!record.isEmpty())
    return record.count();
  else
    return 0;
}
开发者ID:Wushaowei001,项目名称:xtuple,代码行数:9,代码来源:xsqlquery.cpp

示例11: generateRoleNames

void SqlQueryModel::generateRoleNames(const QSqlRecord &rec)
{
	roles.clear();
	if (rec.isEmpty()) {
		for( int i = 0; i < record().count(); i++)
			roles.insert(Qt::UserRole + i + 1, record().fieldName(i).toLocal8Bit());
	} else {
		for( int i = 0; i < rec.count(); i++)
			roles.insert(Qt::UserRole + i + 1, rec.fieldName(i).toLocal8Bit());
	}
}
开发者ID:Guid75,项目名称:showdevant,代码行数:11,代码来源:sqlquerymodel.cpp

示例12: value

QVariant XSqlQuery::value(const QString & name) const
{
  if (name.isEmpty()) 
    return QVariant();

  QSqlRecord r = driver()->record(*this);
  if (!r.isEmpty())
    return value(r.position(name));

  return QVariant();
}
开发者ID:Wushaowei001,项目名称:xtuple,代码行数:11,代码来源:xsqlquery.cpp

示例13: getRecord

QSqlRecord GenericDAO::getRecord(const QString& where, const QVariantList& bindValues, DBMode dbMode) const
{
    DBPair* dbPair = DBPool::getInstance()->getInstanceDBPair();
    Q_ASSERT(dbPair);

    QSqlRecord rec = getRecord(dbPair->getDabase(dbMode), where, bindValues);
    if (!rec.isEmpty())
        return rec;

    return dbMode == Local ? getRecord(dbPair->getDabaseRemote(), where, bindValues) : QSqlRecord();
}
开发者ID:koboveb,项目名称:SVID.TERMINAL,代码行数:11,代码来源:genericdao.cpp

示例14: configurationFromRecord

WineConfiguration WineConfigurationsModel::configurationFromRecord(const QSqlRecord & record) const
{
    WineConfiguration c;
    if ( record.isEmpty() ) return c;

    c.setWinePrefix(record.value("wineprefix").toString());

    WineInstallationsModel *m = qtwineApp->wineInstallationsModel();
    c.setWineInstallation( m->installationById(record.value("wineinstallation").toInt()) );
    return c;
}
开发者ID:gkiagia,项目名称:qtwine,代码行数:11,代码来源:wineconfigurationsmodel.cpp

示例15: removeEntry

bool PlayListDb::removeEntry(QString playList, int pid) {
    QSqlDatabase db = DbConnectionSettings::lastSaved();
    QString tn = tableName(playList);
    QSqlRecord record = db.record(tn);
    Q_ASSERT(!record.isEmpty());
    QString queryString=QString("delete from %1 where pid=%2")
          .arg(tn).arg(pid);
    QSqlQuery q(queryString);
    qDebug() << queryString;
    return q.isActive();
}
开发者ID:FlavioFalcao,项目名称:Intro-Design-Patterns-Cpp-Qt5,代码行数:11,代码来源:playlistdb.cpp


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