本文整理汇总了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);
}
示例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);
}
}
示例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;
}
示例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());//读取广告
}
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}