本文整理汇总了C++中Index::deleteIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ Index::deleteIndex方法的具体用法?C++ Index::deleteIndex怎么用?C++ Index::deleteIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Index
的用法示例。
在下文中一共展示了Index::deleteIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
Index IndexManager;
index_node_t insertNode[10], res;
insertNode[0].value = "1100012957";
insertNode[0].offset = 16;
insertNode[1].value = "1100012950";
insertNode[1].offset = 0;
insertNode[2].value = "1100099999";
insertNode[2].offset = 8;
attr_t attr;
attr.name = "学号";
attr.isPrimary = true;
attr.length = 8;
attr.type = INT;
condition_tree_t *cNode = new condition_tree_t;
cNode->leftOperand = "学号";
// 建立索引
cout << "---建立索引:" << endl;
IndexManager.createIndex("Persons", "学号", attr);
cout << endl;
// 插入索引项
cout << "---插入索引项:" << endl;
IndexManager.insertIndex("Persons", "学号", insertNode[0]);
IndexManager.insertIndex("Persons", "学号", insertNode[1]);
IndexManager.insertIndex("Persons", "学号", insertNode[2]);
cout << endl;
IndexManager.debugPrint("Persons", "学号");
// 查找索引项
cout << "---查找索引项:" << endl;
cNode->opName = EQ;
cNode->rightOperand = "1100012957";
IndexManager.selectIndex("Persons", cNode, &res);
printNode(&res);
cNode->opName = NE;
cNode->rightOperand = "1100012957";
IndexManager.selectIndex("Persons", cNode, &res);
printNode(&res);
cNode->opName = GT;
cNode->rightOperand = "1100012957";
IndexManager.selectIndex("Persons", cNode, &res);
printNode(&res);
cNode->opName = LT;
cNode->rightOperand = "1100099999";
IndexManager.selectIndex("Persons", cNode, &res);
printNode(&res);
cNode->opName = GTE;
cNode->rightOperand = "1100012957";
IndexManager.selectIndex("Persons", cNode, &res);
printNode(&res);
cNode->opName = LTE;
cNode->rightOperand = "1100012957";
IndexManager.selectIndex("Persons", cNode, &res);
printNode(&res);
cout << endl;
// 删除索引项
cout << "---删除索引项:" << endl;
IndexManager.deleteIndex("Persons", "学号", "1100012957");
cout << endl;
// 更新索引项
cout << "---更新索引项:" << endl;
IndexManager.updateIndex("Persons", "学号", "1100099999", "1100199999");
cout << endl;
IndexManager.debugPrint("Persons", "学号");
// 查找索引项
cout << "---查找索引项:" << endl;
cNode->opName = GTE;
cNode->rightOperand = "1100012949";
IndexManager.selectIndex("Persons", cNode, &res);
printNode(&res);
cout << endl;
// 恢复一条索引
IndexManager.insertIndex("Persons", "学号", insertNode[2]);
IndexManager.debugPrint("Persons", "学号");
// OR 合并索引列表
index_node_t ORres, ORres1, ORres2;
cout << "---OR 合并索引列表:" << endl;
cNode->opName = GTE;
cNode->rightOperand = "1100012999";
IndexManager.selectIndex("Persons", cNode, &ORres);
//.........这里部分代码省略.........