• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ setQuery函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setQuery函数的典型用法代码示例。如果您正苦于以下问题:C++ setQuery函数的具体用法?C++ setQuery怎么用?C++ setQuery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: UNUSED

void SociContainer::handleNotification(Dispatcher<SQLPreview::ActionEvent, QVariant, int> *oSource, SQLPreview::ActionEvent nEvent, QVariant oData, int nRows)
{
	UNUSED(oSource);

	Progress prg("Fetch columns...");
	StdString query;

	if(nEvent == SQLPreview::ActionEvent::EVENT_SQL_EXECUTE)
	{
		setTablename("");
		query = oData.value<StdString>();
		mPreviewLimit = nRows;
		setQuery(query);
		refreshPreview(query, mPreviewLimit);
	}
	else if(nEvent == SQLPreview::ActionEvent::EVENT_SQL_TOGGLE)
	{
		bool enabled = oData.value<bool>();
		if(enabled)
		{
			setTablename("");
			mPreviewLimit = mPreviewPanel->getPreviewLimit();
			query = mPreviewPanel->getQuery();
			setQuery(query);
			refreshPreview(query, mPreviewLimit);
		}
	}
}
开发者ID:skeetor,项目名称:datinator,代码行数:28,代码来源:soci_container.cpp


示例2: setQuery

BOOL CInventoryRequest::initInventory()
{
	CString csStateFile;

	if (m_bNotify)
		// Notify IP information changes
		setQuery( _T( "NOTIFY"), _T( "IP"));
	else
	{
		setQuery( _T( "INVENTORY"));

		/****	
		*
		* Package history inventory section
		*
		****/
		m_pLogger->log( LOG_PRIORITY_DEBUG, _T( "INVENTORY => Loading Download history"));
		if (!loadDownloadHistory())
		{
			m_pLogger->log( LOG_PRIORITY_DEBUG, _T("INVENTORY => Failed opening Download Package history file <%s>"), LookupError( GetLastError()));
		}
	}
	/******************/

	if( m_pDeviceid->getOldDeviceID() != _T("") )
		m_cmXml.AddChildElem( _T("OLD_DEVICEID"),m_pDeviceid->getOldDeviceID());
			
	/****	
	*
	* Get the Device netbios Name
	*
	****/

	m_pTheDB	= new CXMLInteract(&m_cmXml);
	m_pState	= new COCSInventoryState;
	m_pPluginState	= new COCSInventoryState;
	m_pSysInfo	= new CSysInfo( getAgentConfig()->isDebugRequired() >= OCS_DEBUG_MODE_TRACE, getDataFolder());

	m_Device.SetDeviceName( m_pDeviceid->getComputerName());
	// Get DeviceId from ocsinventoryFront
	m_Device.SetDeviceID( m_pDeviceid->getDeviceID() );

	/*****
	 *
	 *	Main inventory function
	 *
	 ****/
	// Get Device info
	if (!runInventory())
		return FALSE;

	// Read last inventory state from XML file
	m_pLogger->log( LOG_PRIORITY_DEBUG, _T( "INVENTORY => Reading last inventory state"));
	csStateFile.Format( _T("%s\\%s"), getDataFolder(), OCS_LAST_STATE_FILE);
	if (!m_pState->ReadFromFile( csStateFile, OCS_STATE_STANDARD_SECTION))
		m_pLogger->log( LOG_PRIORITY_WARNING, _T( "INVENTORY => Failed to load/parse inventory state from file <%s>"), csStateFile);
	if (!m_pPluginState->ReadFromFile( csStateFile, OCS_STATE_PLUGIN_SECTION))
		m_pLogger->log( LOG_PRIORITY_WARNING, _T( "INVENTORY => Failed to load/parse plugin state from file <%s>"), csStateFile);
	return TRUE;
}
开发者ID:OCSInventory-NG,项目名称:WindowsAgent,代码行数:60,代码来源:InventoryRequest.cpp


示例3: switch

int PointSqlQueryModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QSqlQueryModel::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setQuery((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QSqlDatabase(*)>(_a[2]))); break;
        case 1: setQuery((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 2: setQuery((*reinterpret_cast< const QSqlQuery(*)>(_a[1]))); break;
        case 3: { QVariant _r = data((*reinterpret_cast< const QModelIndex(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])));
            if (_a[0]) *reinterpret_cast< QVariant*>(_a[0]) = _r; }  break;
        case 4: refresh((*reinterpret_cast< double(*)>(_a[1])),(*reinterpret_cast< double(*)>(_a[2])),(*reinterpret_cast< double(*)>(_a[3]))); break;
        case 5: refreshSearch((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 6: { QVariant _r = datasingle((*reinterpret_cast< const QString(*)>(_a[1])));
            if (_a[0]) *reinterpret_cast< QVariant*>(_a[0]) = _r; }  break;
        case 7: { bool _r = openDB();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 8: initDB(); break;
        case 9: closeDB(); break;
        case 10: { double _r = distance((*reinterpret_cast< double(*)>(_a[1])),(*reinterpret_cast< double(*)>(_a[2])),(*reinterpret_cast< double(*)>(_a[3])),(*reinterpret_cast< double(*)>(_a[4])));
            if (_a[0]) *reinterpret_cast< double*>(_a[0]) = _r; }  break;
        default: ;
        }
        _id -= 11;
    }
    return _id;
}
开发者ID:AndriiZ,项目名称:NokiaBelleApps,代码行数:28,代码来源:moc_pointsqlquerymodel.cpp


示例4: query

void TableModel::DelRecord(const QString &aTblName, const QString &aCondition)
{
    QString str = query().executedQuery();
    emit BeforeRefresh();
    setQuery("DELETE FROM " + aTblName + " WHERE " + aCondition);
    setQuery(str);
    emit Refresh();
}
开发者ID:kravitz,项目名称:kfais,代码行数:8,代码来源:tableModelView.cpp


示例5: setQuery

void Katapult::completeQuery()
{
    if(!bestMatch.isNull()) {
        QString newQuery = bestMatch.item()->text();
        setQuery("");
        setQuery(newQuery);
    }
}
开发者ID:BackupTheBerlios,项目名称:kubuntupult-svn,代码行数:8,代码来源:katapult.cpp


示例6: qDebug

void StopsQueryModel::showStops(int type) {
    qDebug() << "Showstops with type" << type;
    setQuery("SELECT * FROM stopstable WHERE type = 1 ORDER BY rank");
    if (type) {
//        QString query = QString("SELECT * FROM stopstable WHERE type = ") + QString::number(type) + QString(" OR favorite = 1 ORDER BY rank");
//        qDebug() << query;
//        setQuery(query);
    }
    else {
        setQuery("SELECT * FROM stopstable ORDER BY rank");
    }

}
开发者ID:KrisztianOlah,项目名称:london-sail,代码行数:13,代码来源:stopsquerymodel.cpp


示例7: selectStatement

bool GameLibraryModel::select()
{
    const QString query = selectStatement();
    if (query.isEmpty())
        return false;

    beginResetModel();

//    d->clearCache();

    QSqlQuery qu(database());
    qu.prepare(query);
    for (auto &val : params) {
        qu.addBindValue(val);
    }
    qu.exec();
    setQuery(qu);

    if (!qu.isActive() || lastError().isValid()) {
        setTable(tableName()); // resets the record & index
        endResetModel();
        return false;
    }
    endResetModel();
    return true;
}
开发者ID:Gu1,项目名称:Phoenix,代码行数:26,代码来源:gamelibrarymodel.cpp


示例8: FactListModel

 FactListModel(const Q& query, Wt::WObject *parent=0) :
     BaseQM(parent) {
     setQuery(query);
     addColumn("id", tr("facts.fact.id"));
     addColumn("text", tr("facts.fact.text"), Wt::ItemIsEditable);
     addColumn("when_added", tr("facts.common.when_added"));
 }
开发者ID:starius,项目名称:facts,代码行数:7,代码来源:AdminWidget.cpp


示例9: orderString

void SmlAllModel::refresh(int orderColumn, int orderMode)
{
    QString orderString("");
    switch (orderColumn) {
    case 0: {
        if(orderMode) orderString = "ORDER by sml.smlid DESC";
        else orderString = "ORDER by sml.smlid ASC";
    }
    break;
    case 1: {
        if(orderMode) orderString = "ORDER by smla.author DESC";
        else orderString = "ORDER by smla.author ASC";
    }
    break;
    case 2: {
        if(orderMode) orderString = "ORDER by sml.title DESC";
        else orderString = "ORDER by sml.title ASC";
    }
    break;
    case 3: {
        if(orderMode) orderString = "ORDER by smlp.publisher DESC";
        else orderString = "ORDER by smlp.publisher ASC";
    }
    break;
    }

    QSqlQuery query("SELECT sml.smlid, smla.author, sml.title, smlp.publisher FROM sheetmusiclibrary sml, smlauthor smla, smlpublisher smlp WHERE smla.smlauthorid=sml.author AND smlp.smlpublisherid=sml.publisher "+orderString, *myW->getMyDb()->getMyPupilDb());
    setQuery(query);
    if (query.lastError().isValid()) qDebug() << "DB Error: 148 - " << query.lastError();

    setHeaderData(0, Qt::Horizontal, QObject::tr("Index"));
    setHeaderData(1, Qt::Horizontal, QObject::tr("Komponist / Author"));
    setHeaderData(2, Qt::Horizontal, QObject::tr("Titel"));
    setHeaderData(3, Qt::Horizontal, QObject::tr("Verlag"));
}
开发者ID:doitux,项目名称:qupil,代码行数:35,代码来源:smlallmodel.cpp


示例10: dialog

void SoundCloudSearchDialog::showHistoryDialog() {
    SearchHistoryDialog dialog(this);
    
    if (dialog.exec() == QDialog::Accepted) {
        setQuery(dialog.query());
    }
}
开发者ID:marxoft,项目名称:musikloud2,代码行数:7,代码来源:soundcloudsearchdialog.cpp


示例11: CQueryTable

CProcessListTable::CProcessListTable (QWidget * parent, CMySQLServer *m)
: CQueryTable(parent, 0, m, "CProcessListTable")
{
  bool notnew = m->mysql()->version().major <= 3 && m->mysql()->version().minor <= 22;

  sql = "SHOW ";
  if (!notnew)
    sql += "FULL ";
  sql += "PROCESSLIST";

  setKeepColumnWidth(true);
  qry = new CMySQLQuery(m->mysql());
  qry->setEmitMessages(false);
  setQuery(qry);

  columnsWindow = new CTableFieldChooser(0, this, "CProcessListTableColumnsWindow");
  setCaption(tr("Process List"));
  columnsWindow->setCaption("[" + m->connectionName() + "] " + tr("Process List Columns"));
  verticalHeader()->hide();
  setFocusStyle(QTable::FollowStyle);
  setSelectionMode(QTable::MultiRow);
  setLeftMargin(0);
  is_first = true;
  setReadOnly(false);
  refresh();
}
开发者ID:andrewbasterfield,项目名称:mysqlcc,代码行数:26,代码来源:CAdministrationWindow.cpp


示例12: setQuery

//! [0]
void DeviceModel::refresh()
{
    setQuery("SELECT * FROM tab_devices ORDER BY d_typeID, d_producer, d_name");
    setHeaderData(0, Qt::Horizontal, QObject::tr("ID"));
    setHeaderData(1, Qt::Horizontal, QObject::tr("First name"));
    setHeaderData(2, Qt::Horizontal, QObject::tr("Last name"));
}/*
开发者ID:dmnk,项目名称:harbour-smscontrol,代码行数:8,代码来源:devicemodel.cpp


示例13: setQuery

void QgsSpatialQuery::runQuery( QgsFeatureIds &qsetIndexResult,
                                QgsFeatureIds &qsetIndexInvalidTarget,
                                QgsFeatureIds &qsetIndexInvalidReference,
                                int relation, QgsVectorLayer* lyrTarget, QgsVectorLayer* lyrReference )
{
    setQuery( lyrTarget, lyrReference );

    // Create Spatial index for Reference - Set mIndexReference
    mPb->setFormat( QObject::tr( "Processing 1/2 - %p%" ) );
    int totalStep = mUseReferenceSelection
                    ? mLayerReference->selectedFeatureCount()
                    : ( int )( mLayerReference->featureCount() );
    mPb->init( 1, totalStep );
    setSpatialIndexReference( qsetIndexInvalidReference ); // Need set mLayerReference before

    // Make Query
    mPb->setFormat( QObject::tr( "Processing 2/2 - %p%" ) );
    totalStep = mUseTargetSelection
                ? mLayerTarget->selectedFeatureCount()
                : ( int )( mLayerTarget->featureCount() );
    mPb->init( 1, totalStep );

    execQuery( qsetIndexResult, qsetIndexInvalidTarget, relation );

} // QSet<int> QgsSpatialQuery::runQuery( int relation)
开发者ID:stevenmizuno,项目名称:QGIS,代码行数:25,代码来源:qgsspatialquery.cpp


示例14: set_query

 void set_query() {
     dbo::Transaction t(tApp->session());
     ULP::Q q;
     if (only_blocked_) {
         q = tApp->session().query<UserPtr>(
                 "select U from thechess_message_filter F "
                 "left join thechess_user U on F.bad_id = U.id");
         q.where("F.good_id = ?").bind(tApp->user());
     } else {
         q = tApp->session().find<User>();
     }
     if (not_removed_) {
         q.where("rights != ?").bind(NONE);
         q.where("vacation_until is null");
         q.where("last_online > ?").bind(now() - 10 * WEEK);
     }
     if (only_online_) {
         q.where("last_online >= ?");
         q.bind(now() - Options::instance()->away_timeout());
     }
     if (!name_like_.empty()) {
         q.where("(username like ? or id = ?)");
         q.bind("%" + name_like_ + "%");
         q.bind(Wt::Wc::str2int(name_like_.toUTF8()));
     }
     q.orderBy("games_stat_elo desc");
     setQuery(q, /* keep_columns */ true);
 }
开发者ID:starius,项目名称:thechess,代码行数:28,代码来源:UserListWidget.cpp


示例15: isValid

/*!
  Sets this QXmlQuery to the XQuery read from the \a queryURI.  Use
  isValid() after calling this function. If an error occurred reading
  \a queryURI, e.g., the query does not exist, cannot be read, or is
  invalid, isValid() will return \e false.

  The supported URI schemes are the same as those in the XQuery
  function \c{fn:doc}, except that queryURI can be the object of
  a variable binding.

  \a baseURI is the Base URI of the static context, as defined in the
  \l {http://www.w3.org/TR/xquery/}{XQuery language}. It is used
  internally to resolve relative URIs that appear in the query, and
  for message reporting. If \a baseURI is empty, \a queryURI is used.
  Otherwise, \a baseURI is used, and it is resolved against the \l
  {QCoreApplication::applicationFilePath()} {application file path} if
  it is relative.

  If \a queryURI is empty or invalid, or if \a baseURI is invalid,
  the behavior of this function is undefined.
 */
void QXmlQuery::setQuery(const QUrl &queryURI, const QUrl &baseURI)
{
    Q_ASSERT_X(queryURI.isValid(), Q_FUNC_INFO, "The passed URI must be valid.");

    const QUrl canonicalURI(QPatternist::XPathHelper::normalizeQueryURI(queryURI));
    Q_ASSERT(canonicalURI.isValid());
    Q_ASSERT(!canonicalURI.isRelative());
    Q_ASSERT(baseURI.isValid() || baseURI.isEmpty());

    d->queryURI = QPatternist::XPathHelper::normalizeQueryURI(baseURI.isEmpty() ? queryURI : baseURI);

    QPatternist::AutoPtr<QIODevice> result;

    try
    {
        result.reset(QPatternist::AccelTreeResourceLoader::load(canonicalURI, d->m_networkAccessDelegator,
                                                                d->staticContext()));
    }
    catch(const QPatternist::Exception)
    {
        /* We do nothing, result will be 0. */
    }

    if(result)
    {
        setQuery(result.data(), d->queryURI);
        result->close();
    }
    else
        d->recompileRequired();
}
开发者ID:maxxant,项目名称:qt,代码行数:52,代码来源:qxmlquery.cpp


示例16: DATE

void AlarmsLogQueryModel::refresh(const QDate& date1, const QDate& date2)
{
  QSqlQuery query;
  query.prepare("SELECT l.id, l.date_, l.act, l.q, e.text, l.gg, l.zzz "
	   ",l.isRead,e.type,e.isAlert "
	   "FROM tb_logs l "
	   ",tb_events e "
	   "WHERE l.eee=e.id "
	   "AND DATE(l.date_)>=:date1 "
	   "AND DATE(l.date_)<=:date2 "
	   "ORDER BY l.date_ DESC");
  query.bindValue(":date1", date1);
  query.bindValue(":date2", date2);
  query.exec();

  setQuery(query);
  setHeaderData(Date,
  		Qt::Horizontal, trUtf8("Дата"));
  setHeaderData(Act, Qt::Horizontal, trUtf8("ACT"));
  setHeaderData(Q, Qt::Horizontal, trUtf8("Q"));
  setHeaderData(Eee, Qt::Horizontal, trUtf8("EEE"));
  setHeaderData(Gg, Qt::Horizontal, trUtf8("GG"));
  setHeaderData(Zzz, Qt::Horizontal, trUtf8("ZZZ"));
  setHeaderData(Type, Qt::Horizontal, trUtf8("Type"));
}
开发者ID:ukv626,项目名称:tandem,代码行数:25,代码来源:AlarmsLogDialog.cpp


示例17: getProperty

bool SalesModel::setProperty(int rowIndex, const QString &property, const QVariant &value)
{

    QVariantMap rowValues = getProperty(rowIndex);
    const char * UPDATE_STAMENT="UPDATE items_sales set price = :price WHERE prov = :prov and ref = :ref "
            "and size = :size and color = :color and sales_date = :sales_date;";
    m_updateQuery.prepare(UPDATE_STAMENT);
    m_updateQuery.bindValue(":ref",rowValues["ref"]);
    m_updateQuery.bindValue(":size",rowValues["size"]);
    m_updateQuery.bindValue(":color",rowValues["color"]);
    m_updateQuery.bindValue(":prov",rowValues["prov"]);
    m_updateQuery.bindValue(":sales_date",rowValues["date"]);
    m_updateQuery.bindValue(":price", value);
    if(!m_updateQuery.exec()){
        qWarning()<<"could no update sales "<<m_updateQuery.lastQuery();
        return false;

    }
    qDebug()<<"price updated "<<value;
    QHash<int, QByteArray> roles = roleNames();
    QModelIndex ind = index(rowIndex,roles.key("price"));
    QSqlQuery q = query();
    q.exec();
    setQuery(q);

    emit dataChanged(ind,ind);
    return true;

}
开发者ID:IvanFaja,项目名称:EasyTrack,代码行数:29,代码来源:salesmodel.cpp


示例18: setQuery

void EditableSqlModel::refresh()
{
    setQuery("select * from person");
    setHeaderData(0, Qt::Horizontal, QObject::tr("ID"));
    setHeaderData(1, Qt::Horizontal, QObject::tr("First name"));
    setHeaderData(2, Qt::Horizontal, QObject::tr("Last name"));
}
开发者ID:eagafonov,项目名称:qtmoko,代码行数:7,代码来源:editablesqlmodel.cpp


示例19: MetaSQLQueryPrivate

MetaSQLQuery::MetaSQLQuery(const QString & query) {
    _data = new MetaSQLQueryPrivate();
    _source = QString::null;

    if(!query.isEmpty()) {
        setQuery(query);
    }
}
开发者ID:Wushaowei001,项目名称:xtuple,代码行数:8,代码来源:metasql.cpp


示例20: setQuery

void SqlQueryModel::reload()
{
    if (query().exec()) {
        setQuery(query());
    } else {
        qCritical() << tr("Echec de ré-execution de la requète %1 : %2").arg(query().lastQuery()).arg(lastError().text());
    }
}
开发者ID:sebastiendu,项目名称:gestionnairedaffectations,代码行数:8,代码来源:sqlquerymodel.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setRadialAccel函数代码示例发布时间:2022-05-30
下一篇:
C++ setPrototype函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap