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


C++ QSqlQuery::seek方法代码示例

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


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

示例1: onSessionChanged

/*----------------------------------------------------------------------------*/
void SelSessionBox::onSessionChanged(QModelIndex idx)
{
  QSqlQuery q = sessionModel->query();
  q.seek(idx.row());
  int id = q.value(0).toInt();
  database->measureSession(id, m_session);
}
开发者ID:olegyurchenko,项目名称:dda-control,代码行数:8,代码来源:selsessionbox.cpp

示例2: init

void TablePrivate::init()
{
    Q_Q(Table);

    q->setTable(name);
    q->setEditStrategy(QSqlTableModel::OnFieldChange);
    q->select();

    QSqlRecord columnNames = q->record();
    int columnCount = columnNames.count();
    columns.reserve(columnCount);
    for(int i = 0; i < columnCount; ++i) {
        Column *column = new Column(columnNames.field(i), q);
        column->setIndex(i);
        columns.append(column);
        columnsByName.insert(column->name(), column);
    }

    while(q->canFetchMore())
        q->fetchMore();

    QSqlQuery query = q->query();
    int rowCount = q->rowCount();
    int idIndex = q->record().indexOf(QLatin1String("id"));
    int id = 0;
    rows.reserve(rowCount);
    rowsById.reserve(rowCount);
    for(int i = 0; i < rowCount; ++i) {
        query.seek(i);
        id = query.value(idIndex).toInt();
        Row *row = new Row(i, id, q);
        rows.append(row);
        rowsById.insert(id, row);
    }
}
开发者ID:lbproductions,项目名称:ExampleProject,代码行数:35,代码来源:table.cpp

示例3: getOrderLineFromOrderIdAndByModelIndex

int OrderAdapter::getOrderLineFromOrderIdAndByModelIndex(int orderId, const QModelIndex& modelIndex)
{
	QModelIndex index = modelIndex;

	if (index.isValid())
	{
		std::ostringstream tQuery;

		//! TODO - actually query model (instead of duplicating + assumption)
		tQuery << "(SELECT ALL bLine.id, pizza.fqn, bLine.price FROM pizza, purchasable purch, bikeLine bLine " <<
				"WHERE pizza.id = purch.pizzaId AND bLine.pRef = purch.id " <<
				"AND bLine.oRef = " << orderId <<
				") UNION ALL (" <<
				"SELECT ALL bLine.id, menu.name, bLine.price FROM menu, bikeLine bLine, misc, purchasable " <<
				"WHERE menu.id = misc.menuId AND misc.id = purchasable.pizzaId AND bLine.pRef = purchasable.id " <<
				"AND bLine.oRef = " << orderId << ") ORDER BY id ASC;";

		QSqlQuery query;
		query.prepare(tQuery.str().c_str());
		query.exec();

		query.seek(index.row());
		int id = query.value(0).toInt();

		return id;
	}

	return -1;
}
开发者ID:julianandreou,项目名称:pos,代码行数:29,代码来源:OrderAdapter.cpp

示例4: readAd

void MainWindow::readAd(int adId)//读取广告
{
    QSqlQuery adQuery;//对广告表单搜索
    if(adQuery.exec("SELECT aditem FROM adtable WHERE id = "+QString().setNum(adId)))
    {
        int adNumRows = 0;//定义搜索返回的行数
        if(db.driver()->hasFeature(QSqlDriver::QuerySize))//判断驱动是否包含QuerySize
        {
            adNumRows = adQuery.size();//将返回的行数赋于fstNumRows
        }
        else
        {
            adQuery.last();//移至最后一行
            adNumRows = adQuery.at()+1;//将返回的行数赋于fstNumRows
            adQuery.seek(-1);//返回第一行
        }
        if(adNumRows>0)//判断是否大于0
        {
            while(adQuery.next())
            {
                this->adView->loadMap(adQuery.value(0).toByteArray());//读取广告
            }
        }
    }
}
开发者ID:firephoenix,项目名称:wmanual,代码行数:25,代码来源:mainwindow.cpp

示例5: spriteActionTime

const float Database::spriteActionTime(int index) const
{
    QSqlQuery query;
    query.exec("SELECT actionTime FROM sprite");
    query.seek(index-1);
    float actionTime = query.value(0).toInt();
    return actionTime;
}
开发者ID:idxExtropy,项目名称:duel-reality,代码行数:8,代码来源:database.cpp

示例6: spriteActionRate

const int Database::spriteActionRate(int index) const
{
    QSqlQuery query;
    query.exec("SELECT actionRate FROM sprite");
    query.seek(index-1);
    int actionRate = query.value(0).toInt();
    return actionRate;
}
开发者ID:idxExtropy,项目名称:duel-reality,代码行数:8,代码来源:database.cpp

示例7: spriteMovementRange

const int Database::spriteMovementRange(int index) const
{
    QSqlQuery query;
    query.exec("SELECT movementRange FROM sprite");
    query.seek(index-1);
    int movementRange = query.value(0).toInt();
    return movementRange;
}
开发者ID:idxExtropy,项目名称:duel-reality,代码行数:8,代码来源:database.cpp

示例8: spriteAttackRange

const int Database::spriteAttackRange(int index) const
{
    QSqlQuery query;
    query.exec("SELECT attackRange FROM sprite");
    query.seek(index-1);
    int attackRange = query.value(0).toInt();
    return attackRange;
}
开发者ID:idxExtropy,项目名称:duel-reality,代码行数:8,代码来源:database.cpp

示例9: spriteHitPoints

const int Database::spriteHitPoints(int index) const
{
    QSqlQuery query;
    query.exec("SELECT hitPoints FROM sprite");
    query.seek(index-1);
    int HP = query.value(0).toInt();
    return HP;
}
开发者ID:idxExtropy,项目名称:duel-reality,代码行数:8,代码来源:database.cpp

示例10: spriteAttackPower

const int Database::spriteAttackPower(int index) const
{
    QSqlQuery query;
    query.exec("SELECT attackPower FROM sprite");
    query.seek(index-1);
    int AP = query.value(0).toInt();
    return AP;
}
开发者ID:idxExtropy,项目名称:duel-reality,代码行数:8,代码来源:database.cpp

示例11: spriteFileName

QString Database::spriteFileName(int index) const
{
    QSqlQuery query;
    query.exec("SELECT imageFileName FROM sprite");
    query.seek(index-1);
    QString fileName = query.value(0).toString();
    return fileName;
}
开发者ID:idxExtropy,项目名称:duel-reality,代码行数:8,代码来源:database.cpp

示例12: userName

QString Database::userName(int index) const
{
    QSqlQuery query;
    query.exec("SELECT name FROM user");
    query.seek(index-1);
    QString name = query.value(0).toString();
    return name;
}
开发者ID:idxExtropy,项目名称:duel-reality,代码行数:8,代码来源:database.cpp

示例13: organizCinaZPodatkom

//--------------------utech--------------------utech--------------------utech--------------------
bool USkladProgOptions::organizCinaZPodatkom()
{
	QSqlQuery query;
	query.exec("SELECT CinaZPodatkom FROM orgInfo WHERE PidprId=1");
	if (query.seek(0)){
		return query.value(0).toBool();
	}
	else{
		qDebug() << "SQL Table orgInfo has no record with id=1.";
		return true;
	}
}
开发者ID:utech,项目名称:ugurtsklad,代码行数:13,代码来源:USkladProgOptions.cpp

示例14: organizPodatok

/*
	Значення податків:
		0. Фіксований патент ПП
		1. ПДВ
		2. Єдиний податок
*/
int USkladProgOptions::organizPodatok()
{
	QSqlQuery query;
	query.exec("SELECT Podatok FROM orgInfo WHERE PidprId=1");
	if (query.seek(0)){
		return query.value(0).toInt();
	}
	else{
		qDebug() << "SQL Table orgInfo has no record with id=1.";
		return -1;
	}
}
开发者ID:utech,项目名称:ugurtsklad,代码行数:18,代码来源:USkladProgOptions.cpp

示例15: organizVidsotokPodatku

//--------------------utech--------------------utech--------------------utech--------------------
double USkladProgOptions::organizVidsotokPodatku()
{
	QSqlQuery query;
	query.exec("SELECT PodatokVal FROM orgInfo WHERE PidprId=1");
	if (query.seek(0)){
		return query.value(0).toDouble();
	}
	else{
		qDebug() << "SQL Table orgInfo has no record with id=1.";
		return 0;
	}
}
开发者ID:utech,项目名称:ugurtsklad,代码行数:13,代码来源:USkladProgOptions.cpp


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