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


C++ Column::rowCount方法代码示例

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


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

示例1: evaluate


//.........这里部分代码省略.........
					rightTable->columnNames()[0]);
			string rightTableColType = rightTableColumn->getColumnType();

			if (rightTable->columnCount() != 1) {
				throw DatabaseException(18,
						stringRight + " must have 1 column for ANY/ALL.");
			} else if (leftColType.compare(rightTableColType) != 0
					&& !((leftColType == "int" && rightTableColType == "float")
							|| (leftColType == "float"
									&& rightTableColType == "int"))) {
				throw DatabaseException(
						13,
						leftColType + " is not the same as "
								+ rightTableColType);
			}

			int funcType = -1;
			string op = "";
			switch (SWITCH) {
			case ANY:
				funcType = 1;
				op = value.substr(0, value.find("ANY"));
				break;
			case ALL:
				funcType = 2;
				op = value.substr(0, value.find("ALL"));
				break;
			}
			LogicHandler * temp = new LogicHandler("LEFT" + op + "RIGHT");
			temp->parse();
			vector<string> inserts;
			inserts.push_back("LEFT");
			inserts.push_back("RIGHT");
			ExpressionTree * tree = temp->getTree();

			for (int i = 0; i < leftCol->rowCount(); i++) {

				string leftInput = leftCol->getValueAtRowIndex(i);

//				cout<<"\n\nLEFT INPUT IS "<<leftInput<<endl;
//				cout<<"\n\nfollows "<<leftCol->printDataList()<<"index is "<<i<<endl;

				for (int j = 0; j < rightTableColumn->rowCount(); j++) {
					string rightInput = rightTableColumn->getValueAtRowIndex(j);
					vector<string> throwaway;
					throwaway.push_back(leftInput);
					throwaway.push_back(rightInput);
					bool eval = tree->isTrue(inserts, throwaway);

					if (funcType == 1 && eval) {
						return "1";
					} else if (funcType == 2 && !eval) {
						return "0";
					}
				}
			}

			result = (funcType == 1) ? "0" : "1";

		}
			break;
		case IN: //FIXX: Does not catch if the column types differ. Convert types
		{
			result = "0";

			if (db->countColumnsByTable(stringRight) != 1) {
				throw DatabaseException(18,
						stringRight + " does not have only 1 column.");
			}

			Table *theTable = db->findTable(stringRight);

			vector<string> column = theTable->columnNames();

			Column *theColumn = theTable->findColumn(column[0]);

			for (int i = 0; i < theColumn->rowCount(); i++) {
				if (stringLeft == theColumn->getValueAtRowIndex(i)) {
					result = "1";
					break;
				}
			}

		}
			break;
		case EXIST: {
			Table * table = db->findTable(stringRight);
			if (table == NULL) {
				result = "0";
			} else if (table->columnCount() >= 1) {
				result = "1";
			} else {
				result = "0";
			}
		}
			break;
		}
		num = result;
		//this is an operation
	} else {
开发者ID:dtracers,项目名称:SchoolWork,代码行数:101,代码来源:ExpressionTree.cpp


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