本文整理汇总了C++中TableDescriptor::isExist方法的典型用法代码示例。如果您正苦于以下问题:C++ TableDescriptor::isExist方法的具体用法?C++ TableDescriptor::isExist怎么用?C++ TableDescriptor::isExist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableDescriptor
的用法示例。
在下文中一共展示了TableDescriptor::isExist方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateProjection
void CreateProjection(Catalog *catalog, Node *node, ResultSet *&result_set, bool & result_flag, string &error_msg, string &info) {
bool is_correct = true;
Create_projection_stmt *newnode = (Create_projection_stmt *)node;
int partition_num = newnode->partition_num;
string tablename = newnode->tablename;
TableDescriptor *table = NULL;
if((table = catalog->getTable(tablename)) == NULL) // 2014-4-30---add check---by Yu
{
error_msg="There is no table named "+ tablename+" during creating projection";
result_flag=false;
result_set = NULL;
return;
is_correct = false;
return;
}
TableID table_id=catalog->getTable(tablename)->get_table_id();
string partition_attribute_name = newnode->partition_attribute_name;
std::vector<ColumnOffset> index;
index.push_back(0); // add by scdong: add row_id column to each projection automatically
Columns *col_list = (Columns *)newnode->column_list;
string colname;
while(col_list)
{
if (col_list->parameter2 != NULL)
{
colname = col_list->parameter2;
}
else if (col_list->parameter1 != NULL)
{
colname = col_list->parameter1;
}
else
{
error_msg="NO column name during creating projection!";
result_flag=false;
result_set = NULL;
return;
is_correct = false;
break;
}
cout<<tablename+"."+colname<<endl;
if(table->isExist(tablename+"."+colname)) // 2014-4-30---add check---by Yu
index.push_back(table->getAttribute(colname).index);
else
{
error_msg="The column "+ colname+" is not existed! during creating projection";
result_flag=false;
result_set = NULL;
return;
is_correct = false;
break;
}
col_list = (Columns *)col_list->next;
}
if(result_flag==false)
return;
if(!is_correct)
return;
catalog->getTable(table_id)->createHashPartitionedProjection(index,partition_attribute_name,partition_num);
int projection_index = catalog->getTable(table_id)->getNumberOfProjection()-1;
for(unsigned i=0;i<catalog->getTable(table_id)->getProjectoin(projection_index)->getPartitioner()->getNumberOfPartitions();i++){
catalog->getTable(table_id)->getProjectoin(projection_index)->getPartitioner()->RegisterPartition(i,0);
}
catalog->saveCatalog();
// catalog->restoreCatalog();// commented by li to solve the dirty read after insert
result_flag=true;
result_set = NULL;
info = "create projection successfully";
result_set=NULL;
return;
}