1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2025-02-17 11:45:50 +00:00

Fix inserting new files into db.

This commit is contained in:
King_DuckZ 2016-01-11 14:19:18 +00:00
parent 4c97105d97
commit e2438f77fd
3 changed files with 5 additions and 5 deletions

View file

@ -107,7 +107,7 @@ namespace pq {
};
template <>
struct type_to_pqtypes_name<boost::string_ref> {
constexpr static const char* name ( void ) { return "text*"; }
constexpr static const char* name ( void ) { return "text"; }
};
template <>
struct type_to_pqtypes_name<bool> {

View file

@ -200,10 +200,10 @@ namespace mchlib {
}
void populate_rel_paths (const PathName& parBase, std::vector<FileRecordData>& parItems) {
const std::size_t offset = parBase.str_path_size();
const std::size_t offset = parBase.str_path_size() + 1;
for (FileRecordData& itm : parItems) {
assert(itm.abs_path.size() >= offset);
itm.path = boost::string_ref(itm.abs_path).substr(offset);
const auto curr_offset = std::min(offset, itm.abs_path.size());
itm.path = boost::string_ref(itm.abs_path).substr(curr_offset);
assert(itm.path.data());
}
}

View file

@ -109,7 +109,7 @@ namespace din {
//TODO: remove this empty_path part. This is a temporary fix needed to
//work around a bug in libpqtypes for which empty paths are inserted
//as null values in the db.
const char* empty_path = "/";
const char* const empty_path = "/";
const auto empty_path_string = boost::string_ref(empty_path);
for (std::size_t z = 0; z < parData.size(); ++z) {