本文整理汇总了C++中Database::CheckIfIndexExists方法的典型用法代码示例。如果您正苦于以下问题:C++ Database::CheckIfIndexExists方法的具体用法?C++ Database::CheckIfIndexExists怎么用?C++ Database::CheckIfIndexExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database
的用法示例。
在下文中一共展示了Database::CheckIfIndexExists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DropIndex
/*删除索引*/
void API::DropIndex(SQLDropIndex& sql_statement)
{
if (current_database_.length() == 0)/*判断当前数据库是否选定*/
{
throw NoDatabaseSelectedException();
}
Database *db = catalog_manager_->GetDB(current_database_);
if (db == NULL)/*判断当前数据库是否存在*/
{
throw DatabaseNotExistException();
}
if (!db->CheckIfIndexExists(sql_statement.get_index_name()))/*【catalog manager】判断index是否存在*/
{
throw IndexNotExistException();
}
string file_name(path_ + current_database_ + "/" + sql_statement.get_index_name() + ".index");/*【file system】获取文件地址*/
if (!boost::filesystem::exists(file_name))/*【file system】利用boost库判断当前文件是否存在*/
{
cout << "索引文件不存在" << endl;
return;
}
boost::filesystem::remove(file_name);/*【file system】利用boost库删除文件地址对应文件*/
cout << "索引文件已删除。" << endl;
db->DropIndex(sql_statement);/*【catalog manager】目录结构中删除索引*/
cout << "目录文件已写入。" << endl;
catalog_manager_->WriteArchiveFile();/*【catalog manager】在catalog中写文档*/
//cout << "删除索引。" << endl;
}
示例2: CreateIndex
void API::CreateIndex(SQLCreateIndex& statement)
{
cout << "Creating Index: " << statement.get_index_name() << endl;
if (current_db_.length() == 0) throw NoDatabaseSelectedException();
Database *db = catalog_m_->GetDB(current_db_);
if (db->GetTable(statement.get_tb_name()) == NULL) throw TableNotExistException();
if (db->CheckIfIndexExists(statement.get_index_name()) ) throw IndexAlreadyExistsException();
IndexManager *im = new IndexManager(catalog_m_, buffer_m_, current_db_);
im->CreateIndex(statement);
delete im;
}
示例3: DropIndex
void API::DropIndex(SQLDropIndex& statement)
{
if (current_db_.length() == 0) throw NoDatabaseSelectedException();
Database *db = catalog_m_->GetDB(current_db_);
if (db == NULL) throw DatabaseNotExistException();
if (!db->CheckIfIndexExists(statement.get_index_name())) throw IndexNotExistException();
string file_name(path_ + current_db_ + "/" + statement.get_index_name() + ".index");
if (!boost::filesystem::exists(file_name))
{
cout << "Index file doesn't exist!" << endl;
return;
}
boost::filesystem::remove(file_name);
cout << "Index file removed!" << endl;
db->DropIndex(statement);
cout << "Catalog written!" << endl;
catalog_m_->WriteArchiveFile();
}