Пример #1
0
void NGSD::executeQueriesFromFile(QString filename)
{
	QStringList lines = Helper::loadTextFile(filename, true);
	QString query = "";
	for(const QString& line : lines)
	{
		if (line.isEmpty()) continue;
		if (line.startsWith("--")) continue;

		query.append(' ');
		query.append(line);
		if (query.endsWith(';'))
		{
			//qDebug() << query;
			getQuery().exec(query);
			query.clear();
		}
	}
	if (query.endsWith(';'))
	{
		//qDebug() << query;
		getQuery().exec(query);
		query.clear();
	}
}
TEST_F(DocumentSourceMatchTest, MultipleMatchStagesShouldCombineIntoOne) {
    auto match1 = DocumentSourceMatch::create(BSON("a" << 1), getExpCtx());
    auto match2 = DocumentSourceMatch::create(BSON("b" << 1), getExpCtx());
    auto match3 = DocumentSourceMatch::create(BSON("c" << 1), getExpCtx());

    Pipeline::SourceContainer container;

    // Check initial state
    ASSERT_BSONOBJ_EQ(match1->getQuery(), BSON("a" << 1));
    ASSERT_BSONOBJ_EQ(match2->getQuery(), BSON("b" << 1));
    ASSERT_BSONOBJ_EQ(match3->getQuery(), BSON("c" << 1));

    container.push_back(match1);
    container.push_back(match2);
    match1->optimizeAt(container.begin(), &container);

    ASSERT_EQUALS(container.size(), 1U);
    ASSERT_BSONOBJ_EQ(match1->getQuery(), fromjson("{'$and': [{a:1}, {b:1}]}"));

    container.push_back(match3);
    match1->optimizeAt(container.begin(), &container);
    ASSERT_EQUALS(container.size(), 1U);
    ASSERT_BSONOBJ_EQ(match1->getQuery(),
                      fromjson("{'$and': [{'$and': [{a:1}, {b:1}]},"
                               "{c:1}]}"));
}
Пример #3
0
static void manual() { 
    if (smatch(getQuery(), "send")) {
        setHeader("X-SendCache", "true");
        finalize();
    } else if (!espRenderCached(getConn())) {
        render("{ when: %Ld, uri: '%s', query: '%s' }\r\n", mprGetTicks(), getUri(), getQuery());
    }
}
Пример #4
0
int NGSD::geneToApprovedID(const QByteArray& gene)
{
	//init
	static SqlQuery q_gene = getQuery(true);
	static SqlQuery q_prev = getQuery(true);
	static SqlQuery q_syn = getQuery(true);
	static bool init = false;
	if (!init)
	{
		q_gene.prepare("SELECT id FROM gene WHERE symbol=:1");
		q_prev.prepare("SELECT g.id FROM gene g, gene_alias ga WHERE g.id=ga.gene_id AND ga.symbol=:1 AND ga.type='previous'");
		q_syn.prepare("SELECT g.id FROM gene g, gene_alias ga WHERE g.id=ga.gene_id AND ga.symbol=:1 AND ga.type='synonym'");
		init = true;
	}

	//approved
	q_gene.bindValue(0, gene);
	q_gene.exec();
	if (q_gene.size()==1)
	{
		q_gene.next();
		return q_gene.value(0).toInt();
	}

	//previous
	q_prev.bindValue(0, gene);
	q_prev.exec();
	if (q_prev.size()==1)
	{
		q_prev.next();
		return q_prev.value(0).toInt();
	}
	else if(q_prev.size()>1)
	{
		return -1;
	}

	//synonymous
	q_syn.bindValue(0, gene);
	q_syn.exec();
	if (q_syn.size()==1)
	{
		q_syn.next();
		return q_syn.value(0).toInt();
	}

	return -1;
}
Пример #5
0
bool NGSD::tableEmpty(QString table)
{
	SqlQuery query = getQuery();
	query.exec("SELECT COUNT(*) FROM " + table);
	query.next();
	return query.value(0).toInt()==0;
}
Пример #6
0
QStringList NGSD::getEnum(QString table, QString column)
{
	//check cache
	static QMap<QString, QStringList> cache;
	QString hash = table+"."+column;
	if (cache.contains(hash))
	{
		return cache.value(hash);
	}

	//DB query
	SqlQuery q = getQuery();
	q.exec("DESCRIBE "+table+" "+column);
	while (q.next())
	{
		QString type = q.value(1).toString();
		type.replace("'", "");
		type.replace("enum(", "");
		type.replace(")", "");
		cache[hash] = type.split(",");
		return cache[hash];
	}

	THROW(ProgrammingException, "Could not determine enum values of column '"+column+"' in table '"+table+"'!");
}
Пример #7
0
void NGSD::init(QString password)
{
	//remove existing tables
	SqlQuery query = getQuery();
	query.exec("SHOW TABLES");
	if (query.size()>0)
	{
		//check password for re-init of production DB
		if (!test_db_ && password!=Settings::string("ngsd_pass"))
		{
			THROW(DatabaseException, "Password provided for re-initialization of procution database is incorrect!");
		}

		//get table list
		QStringList tables;
		while(query.next())
		{
			tables << query.value(0).toString();
		}

		//remove old tables
		if (!tables.isEmpty())
		{
			query.exec("SET FOREIGN_KEY_CHECKS = 0;");
			query.exec("DROP TABLE " + tables.join(","));
			query.exec("SET FOREIGN_KEY_CHECKS = 1;");
		}
	}

	//initilize
	executeQueriesFromFile(":/resources/NGSD_schema.sql");
}
Пример #8
0
string OAuthClient::getSignedUrl(string url, bool post, bool remove, bool put){
//			cout << "Get URL signed" << endl;

	string urlSigned="";
	string parameter;
	size_t pos = url.find(questionMark);

	string query;
	if(remove)
		query = deleteQuery(url, true);
	else
		if(post)
			query = postQuery(url, true);
		else
			if(put)
				query = putQuery(url, true);
			else
				query = getQuery(url, true);

	if(pos!=string::npos){ // if '?' found
		parameter = url.substr(pos+1, url.size()-1);
		url = url.substr(0,pos);
	}

	urlSigned = url + questionMark + query;

	return urlSigned;
}
Пример #9
0
CPLErr RasdamanRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
				       void * pImage )
  
{
  //cerr << "Read block " << nBlockXOff << " " << nBlockYOff << endl;
  RasdamanDataset *poGDS = (RasdamanDataset *) poDS;
  
  r_Database database;  
  r_Transaction transaction;

  memset(pImage, 0, nRecordSize);

  try {
    database.set_servername(poGDS->host, poGDS->port);
    database.set_useridentification(poGDS->username, poGDS->userpassword);
    database.open(poGDS->databasename);
    transaction.begin();

    char x_lo[11], x_hi[11], y_lo[11], y_hi[11];
    int xPos = poGDS->xPos;
    int yPos = poGDS->yPos;
    
    sprintf(x_lo, "%d", nBlockXOff * nBlockXSize);
    sprintf(x_hi, "%d", (nBlockXOff+1) * nBlockXSize-1);
    sprintf(y_lo, "%d", nBlockYOff * nBlockYSize);
    sprintf(y_hi, "%d", (nBlockYOff+1) * nBlockYSize-1);
    CPLString queryString = getQuery(poGDS->queryParam, x_lo, x_hi, y_lo, y_hi);
  
    r_Set<r_Ref_Any> result_set;
    r_OQL_Query query (queryString);
    r_oql_execute (query, result_set);
    if (result_set.get_element_type_schema()->type_id() == r_Type::MARRAYTYPE) {
      r_Iterator<r_Ref_Any> iter = result_set.create_iterator();
      r_Ref<r_GMarray> gmdd = r_Ref<r_GMarray>(*iter);
      r_Minterval sp = gmdd->spatial_domain();
      r_Point extent = sp.get_extent();
      r_Point base = sp.get_origin();
      int tileX = extent[xPos];
      int tileY = extent[yPos];
      r_Point access = base;
      char *resultPtr;
      for (int j=0; j<tileY; ++j) {
	for (int i=0; i<tileX; ++i) {
	  resultPtr = (char*)pImage + (j*nBlockYSize+i)*typeSize;
	  access[xPos] = base[xPos]+i;
	  access[yPos] = base[yPos]+j;
	  const char *data = (*gmdd)[access] + typeOffset;
	  memcpy(resultPtr, data, typeSize);
	}
      }
    }
    
    transaction.commit();
    database.close();
  } catch (r_Error error) {
    CPLError(CE_Failure, CPLE_AppDefined, "%s", error.what());
    return CPLGetLastErrorType();
  }
  return CE_None;
}
Пример #10
0
void init(){
    // Read the first line containing number of patients
    int tmp ;
    scanf("%d",&tmp);

    // Read into binary tree
    struct node * tree ;
    int i = 0 ;
    for ( i = 0 ; i < tmp ; i++){
        if ( i == 0 ) tree = makeNode(readPatient());
        else{
            insert(&tree,readPatient());
        }
    }

    // Read line containing number of queries.
    scanf("%d",&tmp);
    // Loop tmp number of times, reading the two queries, finding the query, and printing the value
    for ( i = 0 ; i < tmp ; i++ ){
        char * organQ = (char *)malloc(sizeof(char)*20);
        char * bloodtypeQ = (char *)malloc(sizeof(char)*20);
        organT * rtn = NULL ;
        scanf("%s %s",organQ,bloodtypeQ);

        getQuery(&rtn, tree,organQ,bloodtypeQ);
        printPatient((rtn));

        free(organQ);
        free(bloodtypeQ);
        free(rtn);
    }
    recursiveFree(tree);
}
Пример #11
0
int TestUndelete::getPINIndex(PID lPID)
{
	assert(lPID.pid != STORE_INVALID_PID);
	IPIN *lPIN = mSession->getPIN(lPID); 
	if(!lPIN)
	{
		int i = 0;
		for( i = 0; i < (int)mPIDs.size(); i++) if(lPID.pid == mPIDs[i].pid && lPID.ident == mPIDs[i].ident) break;
		Value lV[1]; lV[0].set(i);
		IStmt *lQ = getQuery(4, mPropIDs[1], lV);
		ICursor *lR = NULL;
             	TVERIFYRC(lQ->execute(&lR, 0,0,~0,0,MODE_DELETED));
		if(lR) { lPIN = lR->next(); lR->destroy(); } else assert(lPIN!=NULL && "Failed to get PIN");
		lQ->destroy();
	}
	int lRetVal = 0;
	if(lPIN->defined(&mPropIDs[1], 1)) 
	{
		Value const *lV = lPIN->getValue(mPropIDs[1]); 
		lRetVal = lV->i;
		TVERIFY(lV!=NULL && "NULL Value returned"); 
	}
	lPIN->destroy();
	
	return lRetVal;
}
Пример #12
0
/**
 * @brief Entry point for docker_volumes table.
 */
QueryData genVolumes(QueryContext& context) {
  std::string query;
  std::set<std::string> names;
  getQuery(context, "name", query, names, false);

  QueryData results;
  pt::ptree tree;
  Status s = dockerApi("/volumes" + query, tree);
  if (!s.ok()) {
    VLOG(1) << "Error getting docker volumes: " << s.what();
    return results;
  }

  for (const auto& entry : tree.get_child("Volumes")) {
    try {
      const pt::ptree& node = entry.second;
      Row r;
      r["name"] = getValue(node, names, "Name");
      r["driver"] = node.get<std::string>("Driver", "");
      r["mount_point"] = node.get<std::string>("Mountpoint", "");
      r["type"] = node.get<std::string>("Options.type", "");
      results.push_back(r);
    } catch (const pt::ptree_error& e) {
      VLOG(1) << "Error getting docker volume details: " << e.what();
    }
  }

  return results;
}
Пример #13
0
std::string Uri::toString()
{
  std::ostringstream oss;
  oss << proto_ << "://";
  
  if ( !user_.empty() )
  {
	  oss << user_;
	  if ( !pwd_.empty() )
	  {
		oss << ":" << pwd_;
	  }
	  oss << "@";
  }
	  
  oss << host_;

  if ( port_ != 80 && port_ != 443 && port_ != 22 )
  {
	  oss << ":" << port_;
  }
  oss << path_;
  oss << getQuery();
  if ( anchor_.size() > 0 )
	  oss << "#" << anchor_;
  return oss.str();
}
Пример #14
0
SongListView::SongListView(DataStore *dataStore, QWidget *parent):
  QTableView(parent),
  dataStore(dataStore),
  currentSongListId(-1)
{
  setEditTriggers(QAbstractItemView::NoEditTriggers);
  createActions();
  songListEntryModel = 
    new MusicModel(getQuery(currentSongListId), dataStore, this);

  proxyModel = new QSortFilterProxyModel(this);
  proxyModel->setSourceModel(songListEntryModel);
  setModel(proxyModel);

  setSortingEnabled(true);
  horizontalHeader()->setStretchLastSection(true);
  verticalHeader()->hide();
  setSelectionBehavior(QAbstractItemView::SelectRows);
  setContextMenuPolicy(Qt::CustomContextMenu);
  connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),
    this, SLOT(handleContextMenuRequest(const QPoint&)));
  connect(dataStore, SIGNAL(songListModified(song_list_id_t)),
    this, SLOT(onSongListEntriesChanged(song_list_id_t)));
  connect(dataStore, SIGNAL(songListDeleted(song_list_id_t)),
    this, SLOT(onSongListDelete(song_list_id_t)));
  songListEntryModel->refresh();
  configHeaders();
}
Пример #15
0
static void sml() {
    int     i;
    for (i = 0; i < 1; i++) {
        render("Line: %05d %s", i, "aaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccccddddddd<br/>\r\n");
    }
    render("{ when: %Ld, uri: '%s', query: '%s' }\r\n", mprGetTicks(), getUri(), getQuery());
}
Пример #16
0
void QueryExpression::setQueryContext(QueryContext& inCtx)
{
  if(_ss == NULL){
    MessageLoaderParms parms("Query.QueryExpression.SS_IS_NULL",
                             "Trying to process a query with a NULL SelectStatement.");
    throw QueryException(parms);
  }

  // SelectStatement only allows this to be called once.
  _ss->setQueryContext(inCtx);

#ifndef PEGASUS_DISABLE_CQL
  String cql("CIM:CQL");

  if (_queryLang == cql)
  {
    // Now that we have a QueryContext, we can finish compiling
    // the CQL statement.
    CQLSelectStatement* tempSS = dynamic_cast<CQLSelectStatement*>(_ss);
    if (tempSS != NULL)
    {
      CQLParser::parse(getQuery(), *tempSS);
      tempSS->applyContext();
    }
  }
#endif
}
Пример #17
0
        bool run(OperationContext* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {

            if ( !globalScriptEngine ) {
                errmsg = "server-side JavaScript execution is disabled";
                return false;
            }
            
            /* db.$cmd.findOne( { group : <p> } ) */
            const BSONObj& p = jsobj.firstElement().embeddedObjectUserCheck();

            BSONObj q;
            if ( p["cond"].type() == Object )
                q = p["cond"].embeddedObject();
            else if ( p["condition"].type() == Object )
                q = p["condition"].embeddedObject();
            else
                q = getQuery( p );

            BSONObj key;
            string keyf;
            if ( p["key"].type() == Object ) {
                key = p["key"].embeddedObjectUserCheck();
                if ( ! p["$keyf"].eoo() ) {
                    errmsg = "can't have key and $keyf";
                    return false;
                }
            }
            else if ( p["$keyf"].type() ) {
                keyf = p["$keyf"]._asCode();
            }
            else {
                // no key specified, will use entire object as key
            }

            BSONElement reduce = p["$reduce"];
            if ( reduce.eoo() ) {
                errmsg = "$reduce has to be set";
                return false;
            }

            BSONElement initial = p["initial"];
            if ( initial.type() != Object ) {
                errmsg = "initial has to be an object";
                return false;
            }


            string finalize;
            if (p["finalize"].type())
                finalize = p["finalize"]._asCode();

            const string ns = parseNs(dbname, jsobj);
            Client::ReadContext ctx(txn, ns);

            return group( txn, ctx.ctx().db() , ns , q ,
                          key , keyf , reduce._asCode() , reduce.type() != CodeWScope ? 0 : reduce.codeWScopeScopeDataUnsafe() ,
                          initial.embeddedObject() , finalize ,
                          errmsg , result );
        }
Пример #18
0
static void huge() { 
    int     i;
    //  This will emit ~762K (over the item limit)
    for (i = 0; i < 10000; i++) {
        render("Line: %05d %s", i, "aaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccccddddddd<br/>\r\n");
    }
    render("{ when: %Ld, uri: '%s', query: '%s' }\r\n", mprGetTicks(), getUri(), getQuery());
}
Пример #19
0
enum ePrivilegeLevel cUser::privilegeLevel() const
{
    if (_privilegeLevel == ENUM_INVALID) {
        QSqlQuery q = getQuery();
        return const_cast<cUser *>(this)->getRights(q);
    }
    return (ePrivilegeLevel)_privilegeLevel;
}
Пример #20
0
    bool run(const string& dbname, BSONObj& jsobj, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {

        /* db.$cmd.findOne( { group : <p> } ) */
        const BSONObj& p = jsobj.firstElement().embeddedObjectUserCheck();

        BSONObj q;
        if ( p["cond"].type() == Object )
            q = p["cond"].embeddedObject();
        else if ( p["condition"].type() == Object )
            q = p["condition"].embeddedObject();
        else
            q = getQuery( p );

        if ( p["ns"].type() != String ) {
            errmsg = "ns has to be set";
            return false;
        }

        string ns = dbname + "." + p["ns"].String();

        BSONObj key;
        string keyf;
        if ( p["key"].type() == Object ) {
            key = p["key"].embeddedObjectUserCheck();
            if ( ! p["$keyf"].eoo() ) {
                errmsg = "can't have key and $keyf";
                return false;
            }
        }
        else if ( p["$keyf"].type() ) {
            keyf = p["$keyf"]._asCode();
        }
        else {
            // no key specified, will use entire object as key
        }

        BSONElement reduce = p["$reduce"];
        if ( reduce.eoo() ) {
            errmsg = "$reduce has to be set";
            return false;
        }

        BSONElement initial = p["initial"];
        if ( initial.type() != Object ) {
            errmsg = "initial has to be an object";
            return false;
        }


        string finalize;
        if (p["finalize"].type())
            finalize = p["finalize"]._asCode();

        return group( dbname , ns , q ,
                      key , keyf , reduce._asCode() , reduce.type() != CodeWScope ? 0 : reduce.codeWScopeScopeData() ,
                      initial.embeddedObject() , finalize ,
                      errmsg , result );
    }
Пример #21
0
const std::string Uri::getFullPath() const
{
  std::ostringstream oss;
  oss << path_;
  oss << getQuery();
  if ( anchor_.size() > 0 )
	  oss << "#" << anchor_;
  return oss.str();
}
Пример #22
0
void FindSequenceDialog::aaSearch ()
    {
    int a , b ;
    TVector *v = c->vec ;
    if ( v->getType() != TYPE_VECTOR && 
    	 v->getType() != TYPE_SEQUENCE && 
    	 v->getType() != TYPE_PRIMER )
    	 return ;
    	 
    wxString s = getQuery() ;
    for ( a = 0 ; a < v->items.size() ; a++ )
        {
        wxString ls = v->items[a].getAminoAcidSequence() ;
        if ( ls.IsEmpty() ) continue ;
        int dir = v->items[a].getDirection() ;
        int off = v->items[a].getOffset() ;
        vector <Tdna2aa> dna2aa ;
        p = 0 ;
        b = subsearch ( ls , s , p ) ;
        while ( b != -1 )
           {
           if ( lb->GetCount() > FIND_MAX ) return ;
           if ( dna2aa.size() == 0 )
              v->items[a].translate ( v , NULL , dna2aa ) ;
           int from = dir==1?b:last ;
           int to = dir==1?last:b ;
           wxString msg ;
           if ( off != -1 )
              msg = wxString::Format ( _T(" [%d-%d]") , from+off , to+off ) ;
           from = dna2aa[from].dna[0] + 1 ;
           to = dna2aa[to].dna[2] + 1 ;
           if ( from > to ) { int x = from ; from = to ; to = x ; }
           lb->Append ( wxString::Format ( _T("%s: %s (%d-%d)%s") ,
                                 txt("amino_acid").c_str() ,
                                 v->items[a].name.c_str() ,
                                 from , to , msg.c_str() ) ) ;
           vi.Add ( -1 ) ;
           p = b + 1 ;
           b = subsearch ( ls , s , p ) ;
           }
        }   
        
    // Fixed reading frames
    wxString ss ;
    ss = v->getSequence() ;
    if ( v->isCircular() ) ss += ss.Left ( 2 ) ;
    else ss += _T("  ") ;
    aaSubSearch ( ss , 0 , 1 , txt("m_aa_1") ) ; // Reading frame +1
    aaSubSearch ( ss , 1 , 1 , txt("m_aa_2") ) ; // Reading frame +2     
    aaSubSearch ( ss , 2 , 1 , txt("m_aa_3") ) ; // Reading frame +3
    ss = v->transformSequence ( true , false ) ;
    if ( v->isCircular() ) ss = ss.Right ( 2 ) + ss ;
    else ss = _T("  ") + ss ;
    aaSubSearch ( ss , -1 , -1 , txt("m_aa_m1") ) ; // Reading frame -1     
    aaSubSearch ( ss , -2 , -1 , txt("m_aa_m2") ) ; // Reading frame -2     
    aaSubSearch ( ss , -3 , -1 , txt("m_aa_m3") ) ; // Reading frame -3    
    }    
Пример #23
0
void TestUndelete::testClass()
{	
	IStmt *lQ = getQuery(2);
	long const lStartTime = getTimeInMs();
	test(lQ);
	long const lEndTime = getTimeInMs();
	mLogger.out() << "Time taken for testClass() :: " << (lEndTime - lStartTime) << " ms" << std::endl;
	lQ->destroy();
}
Пример #24
0
void NGSD::tableExists(QString table)
{
	SqlQuery query = getQuery();
	query.exec("SHOW TABLES LIKE '" + table + "'");
	if (query.size()==0)
	{
		THROW(DatabaseException, "Table '" + table + "' does not exist!")
	}
}
Пример #25
0
void NGSD::setReportVariants(const QString& filename, const VariantList& variants, QSet<int> selected_indices)
{
	QString ps_id = processedSampleId(filename);

	//get variant ID
	for(int i=0; i<variants.count(); ++i)
	{
		getQuery().exec("UPDATE detected_variant SET report=" + QString(selected_indices.contains(i) ? "1" : "0" ) + " WHERE processed_sample_id='" + ps_id + "' AND variant_id='" + variantId(variants[i]) + "'");
	}
}
Пример #26
0
void TestUndelete::testFullScan()
{
	Value lV[1]; lV[0].set(mQueryStr.c_str());
	IStmt *lQ = getQuery(1, mPropIDs[2], lV);
	long const lStartTime = getTimeInMs();
	test(lQ);
	long const lEndTime = getTimeInMs();
	mLogger.out() << "Time taken for testFullScan() :: " << (lEndTime - lStartTime) << " ms" << std::endl;	
	lQ->destroy();
}
Пример #27
0
int main(int argc, char *argv[])
{
    cLv2QApp app(argc, argv);
    SETAPP();
    lanView::snmpNeeded = true;
    lanView::sqlNeeded  = SN_SQL_NEED;

    lv2test   mo;
    if (mo.lastError != NULL) {
        _DBGFNL() << mo.lastError->mErrorCode << endl;
        return mo.lastError->mErrorCode; // a mo destruktora majd kiírja a hibaüzenetet.
    }
    if (mo.lastError) {  // Ha hiba volt, vagy vége
        return mo.lastError->mErrorCode; // a mo destruktora majd kiírja a hibaüzenetet.
    }
    try {
/*        cRecordAny a1;
        cRecordAny a2;
        cNode       n;
        cSnmpDevice s;
        a1 = n;
        a2 = s;
        n.clone(a1);
        s.clone(a2);
        n.clone(a2);
        n.clone(n);
        n.clone(s);
        s.clone(a1);*/
        QString exp;
        QSqlQuery q = getQuery();

/*        cUser u;
        if (u.fetch(*mo.pq, false, QBitArray(1))) {
            do {
                exp = u.objectExport(q, 1);
                PDEB(INFO) << exp << endl;
            } while (u.next(*mo.pq));
        }


        cEnumVal oev;
        if (oev.fetch(*mo.pq, false, QBitArray(1))) {
            do {
                exp = oev.objectExport(q, 1);
                PDEB(INFO) << exp << endl;
            } while (oev.next(*mo.pq));
        }*/
        cTableShape ts;
        ts.setByName(q, "nodes");
        exp = ts.objectExport(q);
        PDEB(INFO) << exp << endl;

    } CATCHS(mo.lastError)
    return mo.lastError == NULL ? 0 : mo.lastError->mErrorCode;
}
Пример #28
0
bool DnsLayer::removeQuery(const std::string& queryNameToRemove, bool exactMatch)
{
	DnsQuery* queryToRemove = getQuery(queryNameToRemove, exactMatch);
	if (queryToRemove == NULL)
	{
		LOG_DEBUG("Query not found");
		return false;
	}

	return removeQuery(queryToRemove);
}
Пример #29
0
/**
 * @brief Utility method to get containers tree.
 */
Status getContainers(QueryContext& context,
                     std::set<std::string>& ids,
                     pt::ptree& containers) {
  std::string query;
  getQuery(context, "id", query, ids, true);

  Status s = dockerApi("/containers/json" + query, containers);
  if (!s.ok()) {
    VLOG(1) << "Error getting docker containers: " << s.what();
    return s;
  }
  return Status(0);
}
Пример #30
0
 bool MultiPlanRunner::forceYield() {
     saveState();
     ClientCursor::registerRunner(this);
     ClientCursor::staticYield(ClientCursor::suggestYieldMicros(),
                               getQuery().getParsed().ns(),
                               NULL);
     // During the yield, the database we're operating over or any collection we're relying on
     // may be dropped.  When this happens all cursors and runners on that database and
     // collection are killed or deleted in some fashion. (This is how the _killed gets set.)
     ClientCursor::deregisterRunner(this);
     if (!_killed) { restoreState(); }
     return !_killed;
 }