本文整理汇总了C++中DocumentInfo::getInternalPath方法的典型用法代码示例。如果您正苦于以下问题:C++ DocumentInfo::getInternalPath方法的具体用法?C++ DocumentInfo::getInternalPath怎么用?C++ DocumentInfo::getInternalPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentInfo
的用法示例。
在下文中一共展示了DocumentInfo::getInternalPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setAttribute
bool MetaDataBackup::setAttribute(const DocumentInfo &docInfo,
const string &name, const string &value, bool noXAttr)
{
string url(docInfo.getLocation());
string urlWithIPath(docInfo.getLocation(true));
#ifdef HAVE_ATTR_XATTR_H
Url urlObj(url);
// If the file is local and isn't a nested document, use an extended attribute
if ((noXAttr == false) &&
(urlObj.isLocal() == true) &&
(docInfo.getInternalPath().empty() == true))
{
string fileName(url.substr(urlObj.getProtocol().length() + 3));
string attrName("pinot." + name);
// Set an attribute, and add an entry in the table
if (setxattr(fileName.c_str(), attrName.c_str(),
value.c_str(), (size_t)value.length(), 0) != 0)
{
#ifdef DEBUG
cout << "MetaDataBackup::setAttribute: setxattr failed with " << strerror(errno) << endl;
#endif
}
}
#endif
bool update = false, success = false;
// Is there already such an item for this URL ?
SQLResults *results = executeStatement("SELECT Url FROM MetaDataBackup \
WHERE Url='%q' AND Name='%q';",
Url::escapeUrl(urlWithIPath).c_str(), name.c_str());
if (results != NULL)
{
SQLRow *row = results->nextRow();
if (row != NULL)
{
// Yes, there is
update = true;
delete row;
}
delete results;
}
if (update == false)
{
results = executeStatement("INSERT INTO MetaDataBackup \
VALUES('%q', '%q', '%q');",
Url::escapeUrl(urlWithIPath).c_str(), name.c_str(), value.c_str());
}