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


C++ setQuery函数代码示例

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


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


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