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


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

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


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

示例1: finished

bool League::finished() {
    //calculate games count
    //
    int max;
    if (clubs.count() %2 == 0)
    {
       max = ((clubs.count()-1)*2)*(clubs.count() /2);

    }
    else {
        int count = clubs.count() + 1;
        max = ((count-1)*2)*(count/2);
    }
//смотрим максимальный сыгранный тур
QSqlQuery q;
q.prepare("SELECT COUNT (*) FROM Matches");
if (!q.exec()) {qDebug() << "SQL Error: " + q.lastError().text() + ", query " + q.executedQuery();}
else {qDebug() << "Query done: " + q.executedQuery();}
q.first();
if (max <= q.value(0).toInt()) {
    writeResults();
    return true;
}
else
    return false;

}
开发者ID:pashazz,项目名称:rksmanager,代码行数:27,代码来源:leaguetrn.cpp

示例2: clearLogs

void Logging::clearLogs(void){
    QSqlQuery query;
    query.exec("DELETE FROM logging");
    if (!query.exec()){
        qDebug()<<"clearLogs.SqlError: "<<query.lastError()<<query.executedQuery();
    }
    query.exec("VACUUM");
    if (!query.exec()){
        qDebug()<<"clearLogs.SqlError: "<<query.lastError()<<query.executedQuery();
    }
    return;
}
开发者ID:cyrg2012,项目名称:q4wine,代码行数:12,代码来源:logging.cpp

示例3: execQuery

bool AMDatabase::execQuery(QSqlQuery &query, int timeoutMs)
{
	if (isReadOnly() && !(query.executedQuery().startsWith("SELECT", Qt::CaseInsensitive) || query.executedQuery().startsWith("PRAGMA", Qt::CaseInsensitive))){

		AMErrorMon::debug(this, AMDATABASE_IS_READ_ONLY, QString("This database is read-only and the desired command would modify the contents of the database. Query: %1").arg(query.executedQuery()));
		return false;
	}

	QTime startTime;
	startTime.start();

	bool success;
	int lastErrorNumber;
	QString lastErrorMessage;
	int attempt = 0;
	do {
		success = query.exec();
		lastErrorNumber = query.lastError().number();
		lastErrorMessage = query.lastError().text();
		attempt++;
		if(lastErrorNumber == 5)
			usleep(5000);
	} while(success != true && startTime.elapsed() < timeoutMs && (lastErrorNumber == 5));

	if(attempt > 1) {
		if(success) {
			AMErrorMon::debug(0, AMDATABASE_LOCK_FOR_EXECQUERY_CONTENTION_SUCCEEDED, QString("AMDatabase detected contention for database locking in execQuery(). It took %1 tries for the query to succeed.").arg(attempt) );
		}
		else {
			AMErrorMon::debug(0, AMDATABASE_LOCK_FOR_EXECQUERY_CONTENTION_FAILED, QString("AMDatabase detected contention for database locking in execQuery(). After %1 attempts, the query still did not succeed. The last error is %2").arg(attempt).arg(lastErrorMessage) );
		}
	}

	return success;
}
开发者ID:acquaman,项目名称:acquaman,代码行数:35,代码来源:AMDatabase.cpp

示例4: menusModify

void menusViewDialog::menusModify(){
    getMenusID();

    QSqlQuery *getMenu = new QSqlQuery();
    getMenu->prepare("SELECT menu_id, name, altname, price, category_id "
                     "FROM public.menus "
                     "WHERE deleted='0' "
                     "AND menu_id=:menuCurrentID");
    getMenu->bindValue(":menuCurrentID",menuCurrentID);
    getMenu->exec();
    if(getMenu->lastError().isValid())
        qDebug() << trUtf8("Запрос:") << getMenu->executedQuery();
    while (getMenu->next()){
        menuID = getMenu->value(0).toInt();
        menuName = getMenu->value(1).toString();
        menuAltName = getMenu->value(2).toString();
        menuPrice = getMenu->value(3).toInt();
        categoryID = getMenu->value(4).toInt();
        qDebug() << trUtf8("Menu ID: ") << menuID;
        qDebug() << trUtf8("Menu Name: ") << menuName;
        qDebug() << trUtf8("Menu Alt Name: ") << menuAltName;
        qDebug() << trUtf8("Menu Price: ") << menuPrice;
        qDebug() << trUtf8("Category ID: ") << categoryID;
    }

    menusChangeDialog dialog(this);
    dialog.menusEdit(menuID,menuName,menuAltName,menuPrice,categoryID);
    dialog.exec();
    if(dialog.close())
        getMenusList();
}
开发者ID:pgulyaev88,项目名称:elpos.manager,代码行数:31,代码来源:menusviewdialog.cpp

示例5: deleteLogs

void Logging::deleteLogs(QString prefix_name){
    QSqlQuery query;
    query.prepare("DELETE FROM logging WHERE prefix_id=(SELECT id FROM prefix WHERE name=:prefix_name);");
    query.bindValue(":prefix_name", prefix_name);

    if (!query.exec()){
        qDebug()<<"SqlError: "<<query.lastError()<<query.executedQuery();
    }
    return;
}
开发者ID:cyrg2012,项目名称:q4wine,代码行数:10,代码来源:logging.cpp

示例6: updateIconName

void IconManager::updateIconName(int catId, int iconId, const QString &iconName)
{
    QString sql = "UPDATE Icons SET name = '" + iconName + "' WHERE catId = " + QString::number(catId) + " AND id = " + QString::number(iconId);
    QSqlQuery *q = new QSqlQuery(db);
    q->prepare(sql);
    q->exec();
    printQS(q->executedQuery());
    delete q;

}
开发者ID:emware,项目名称:qtcat-emware,代码行数:10,代码来源:iconmanager.cpp

示例7: delImage

bool Image::delImage(const QString name) const{
    QSqlQuery query;
    query.prepare("DELETE FROM images WHERE name=:name");
    query.bindValue("name", name);

    if (!query.exec()){
        qDebug()<<"SqlError: "<<query.lastError()<<query.executedQuery();
        return false;
    }
    return true;
}
开发者ID:PappBence,项目名称:q4wine,代码行数:11,代码来源:image.cpp

示例8: delByName

bool Prefix::delByName(const QString prefix_name) const{
    QSqlQuery query;
    query.prepare("DELETE FROM prefix WHERE id=(SELECT id FROM prefix WHERE name=:prefix_name )");
    query.bindValue(":prefix_name", prefix_name);

    if (!query.exec()){
        qDebug()<<"SqlError: "<<query.lastError()<<query.executedQuery();
        return false;
    }
    return true;
}
开发者ID:Vdragon,项目名称:q4wine,代码行数:11,代码来源:prefix.cpp

示例9: renameImage

bool Image::renameImage(const QString name, const QString old_name) const{
    QSqlQuery query;
    query.prepare("UPDATE images SET name=:name WHERE name=:old_name");
    query.bindValue("name", name);
    query.bindValue("old_name", old_name);

    if (!query.exec()){
        qDebug()<<"SqlError: "<<query.lastError()<<query.executedQuery();
        return false;
    }
    return true;
}
开发者ID:PappBence,项目名称:q4wine,代码行数:12,代码来源:image.cpp

示例10: addImage

bool Image::addImage(const QString name, const QString path) const{
    QSqlQuery query;
    query.prepare("INSERT INTO images(name, path) VALUES(:name, :path)");
    query.bindValue("name", name);
    query.bindValue("path", path);

    if (!query.exec()){
        qDebug()<<"SqlError: "<<query.lastError()<<query.executedQuery();
        return false;
    }
    return true;
}
开发者ID:PappBence,项目名称:q4wine,代码行数:12,代码来源:image.cpp

示例11: addDir

bool Dir::addDir(const QString prefix_name, const QString dir_name) const{
	QSqlQuery query;
	query.prepare("INSERT INTO dir(name, prefix_id) VALUES(:name, (SELECT id FROM prefix WHERE name=:prefix_name))");
	query.bindValue(":prefix_name", prefix_name);
	query.bindValue(":name", dir_name);

	if (!query.exec()){
		qDebug()<<"SqlError: "<<query.lastError()<<query.executedQuery();
		return false;
	}
	return true;
}
开发者ID:PappBence,项目名称:q4wine,代码行数:12,代码来源:dir.cpp

示例12: execSql

QSqlQuery ClvDataAccessor::execSql(QSqlQuery query){
    bool success = query.exec();
    if(AppInfo::DEBUG_CLV_DATA_ACCESSOR){
        qDebug() << "EXEC SQL: " << query.lastQuery();
    }
    if(!success){
        qDebug();
        qDebug() << QString("SQL Error:'%1'").arg(query.executedQuery());
        qDebug() << query.lastError().text();
        qDebug();
    }
    return query;
}
开发者ID:yuichi110,项目名称:CiscoLogViewer,代码行数:13,代码来源:dao_clvdataaccessor.cpp

示例13: isExistsByName

bool Image::isExistsByName(const QString name) const{
    QSqlQuery query;
    query.prepare("SELECT id FROM images WHERE name=:name");
    query.bindValue(":name", name);
    if (!query.exec()){
        qDebug()<<"SqlError: "<<query.lastError()<<query.executedQuery();
        return false;
    }
    query.first();
    if (query.isValid()){
        return true;
    }
    return false;
}
开发者ID:PappBence,项目名称:q4wine,代码行数:14,代码来源:image.cpp

示例14: renameDir

bool Dir::renameDir(const QString dir_name, const QString prefix_name, const QString new_dir_name) const{
	QSqlQuery query;
	query.prepare("UPDATE dir SET name=:new_dir_name WHERE name=:dir_name AND prefix_id=(SELECT id FROM prefix WHERE name=:prefix_name)");
	query.bindValue(":prefix_name", prefix_name);
	query.bindValue(":new_dir_name", new_dir_name);
	query.bindValue(":dir_name", dir_name);

	if (!query.exec()){
		qDebug()<<"SqlError: "<<query.lastError()<<query.executedQuery();
		return false;
	}

	return true;
}
开发者ID:PappBence,项目名称:q4wine,代码行数:14,代码来源:dir.cpp

示例15: setCountDish

void residuesFilialForm::setCountDish(QString tableName,int d){
//    int c;
//    QString tableName;
//    tableName = "countsp";
    QSqlDatabase::database();

    QString updateDishQuery;
    updateDishQuery = QString("%1 %2 %3 %4 %5").arg("UPDATE dish SET ").arg(tableName).arg(" = ").arg(d).arg("WHERE users=1 AND id=1");
    qDebug() << updateDishQuery;

    QSqlQuery *updateDish = new QSqlQuery;
    updateDish->prepare(updateDishQuery);
    updateDish->exec();
    if(updateDish->lastError().isValid()){
        qDebug() << updateDish->lastError();
        qDebug() << updateDish->executedQuery();
        qDebug() << updateDish->lastQuery();
    } else {
        qDebug() << updateDish->executedQuery();
        qDebug() << "Sell Complited. " << tableName << " = " << d ;
    }

    updateResiduesFilial();
}
开发者ID:pgulyaev88,项目名称:elpos,代码行数:24,代码来源:residuesfilialform.cpp


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