本文整理汇总了C++中Tag::SaveToDB方法的典型用法代码示例。如果您正苦于以下问题:C++ Tag::SaveToDB方法的具体用法?C++ Tag::SaveToDB怎么用?C++ Tag::SaveToDB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::SaveToDB方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ImportTags
bool TagsDatabase::ImportTags()
{
// Open the file
tagFileInfo info;
tagFile *const file = tagsOpen(_tagsFile.c_str(), &info);
if (file == NULL)
{
MsgBox("Something went wrong opening generated tags file");
return false;
}
try
{
// First delete the old database (if any)
Delete();
// Create the new database
Open();
// Prepare the statement
SqliteStatement stmt(this);
stmt.Prepare("INSERT INTO Tags(Tag, File, Line, Pattern, Type, Language, MemberOf, MemberOfType, Inherits, Signature, Access, Implementation, ThisFileOnly, Unrecognized) VALUES (@tag, @file, @line, @pattern, @type, @language, @memberof, @memberoftype, @inherits, @signature, @access, @implementation, @thisfileonly, @unrecognized)");
// Go through the records and save them in the database
Tag tag;
tagEntry entry;
BeginTransaction();
while (tagsNext(file, &entry) == TagSuccess)
{
// Put it in the array
tag = entry;
// Is there anything to search for?
if (tag.getPattern().length() == 0 && tag.getLine() == 0)
continue;
// Very long search pattern in JavaScript, minimized?
if (tag.getLanguage() == "JavaScript")
if (tag.getPattern().length() >= MAX_PATH)
continue;
tag.SaveToDB(&stmt, _curDir);
}
stmt.Finalize();
CommitTransaction();
Close();
}
catch (SqliteException e)
{
tagsClose(file);
MsgBoxf("Something went wrong convert tags file to database!\n%s", e.what());
return false;
}
// Close the tags file
tagsClose(file);
return true;
}