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


C++ Tuple::getNumOfFields方法代码示例

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


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

示例1: join

void join(Tuple tuple1, Tuple tuple2, string tableName1, string tableName2, string whereCondition, bool multi, vector<string> attributes) {
	Relation *relation = schemaManager.getRelation(tableName2+"_join");
	Tuple tuple =relation->createTuple();
	if(!multi) {
		for(int i=0;i<tuple1.getNumOfFields();i++) {
			if(tuple1.getSchema().getFieldType(i) == INT)
			tuple.setField(tableName1+"."+tuple1.getSchema().getFieldName(i), tuple1.getField(i).integer);
			else
			tuple.setField(tableName1+"."+tuple1.getSchema().getFieldName(i), *(tuple1.getField(i).str) );
		}
	}
	else {
		 for(int i=0;i<tuple1.getNumOfFields();i++) {
                        if(tuple1.getSchema().getFieldType(i) == INT)
                        tuple.setField(tuple1.getSchema().getFieldName(i), tuple1.getField(i).integer);
                        else
                        tuple.setField(tuple1.getSchema().getFieldName(i), *(tuple1.getField(i).str) );
                }
	}
	for(int i=0;i<tuple2.getNumOfFields();i++) {
	        if(tuple2.getSchema().getFieldType(i) == INT)
                tuple.setField(tableName2+"."+tuple2.getSchema().getFieldName(i), tuple2.getField(i).integer);
                else                
		tuple.setField(tableName2+"."+tuple2.getSchema().getFieldName(i), *(tuple2.getField(i).str) );
        }
	if((attributes.size()==1 && attributes[0]=="*") || multi) {
		if(whereConditionEvaluator(whereCondition, tuple)) 
		insertTuple(tableName2+"_join", tuple);
	}
	else {
		Relation *relation1 = schemaManager.getRelation(tableName2+"_joinp");
		Tuple tuplep = relation1->createTuple();
		for(int i=0;i<attributes.size();i++) {
			if(tuplep.getSchema().getFieldType(attributes[i]) == INT)
			tuplep.setField(attributes[i], tuple.getField(attributes[i]).integer);
			else
			tuplep.setField(attributes[i], *(tuple.getField(attributes[i]).str));
		}	
		if(whereConditionEvaluator(whereCondition, tuple))
		insertTuple(tableName2+"_joinp", tuplep);
	}
}
开发者ID:ravitx,项目名称:608,代码行数:42,代码来源:core.cpp

示例2: compare

bool compare(Tuple tuple1, Tuple tuple2) {

	Schema tupleSchema = tuple1.getSchema();
	for(int i=0;i<tuple1.getNumOfFields();i++) {
		if(tupleSchema.getFieldType(i) == INT) {
			if(tuple1.getField(i).integer != tuple2.getField(i).integer)
			return false;
		}
		else {
			if(*(tuple1.getField(i).str) != *(tuple2.getField(i).str)) 
			return false;
		}
	}
	return true;
}
开发者ID:ravitx,项目名称:608,代码行数:15,代码来源:core.cpp

示例3: printTuple

void printTuple(Tuple tuple){
  // Print the information about the tuple
  cout << "Created a tuple " << tuple << " through the relation" << endl;
  cout << "The tuple is invalid? " << (tuple.isNull()?"TRUE":"FALSE") << endl;
  Schema tuple_schema = tuple.getSchema();
  cout << "The tuple has schema" << endl;
  cout << tuple_schema << endl;
  cout << "A block can allow at most " << tuple.getTuplesPerBlock() << " such tuples" << endl;
  
  cout << "The tuple has fields: " << endl;
  for (int i=0; i<tuple.getNumOfFields(); i++) {
    if (tuple_schema.getFieldType(i)==INT)
      cout << tuple.getField(i).integer << "\t";
    else
      cout << *(tuple.getField(i).str) << "\t";
  }
  cout << endl << endl;
}
开发者ID:cjb3768,项目名称:CSCE-608-Project-2,代码行数:18,代码来源:last_working.cpp


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