Commit a8884c5d authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

Use a const sqlite::Row to load the cache key

parent 4be33502
......@@ -37,7 +37,7 @@ namespace policy
return self->path();
}
FolderCache::KeyType FolderCache::key(sqlite::Row& row )
FolderCache::KeyType FolderCache::key(const sqlite::Row& row )
{
return row.load<FolderCache::KeyType>( 1 );
}
......
......@@ -47,7 +47,7 @@ struct FolderCache
{
using KeyType = std::string;
static const KeyType& key( const IFolder* self );
static KeyType key( sqlite::Row& row );
static KeyType key( const sqlite::Row& row );
};
}
......
......@@ -95,7 +95,7 @@ const std::string&policy::LabelCachePolicy::key( const ILabel* self )
return self->name();
}
std::string policy::LabelCachePolicy::key(sqlite::Row& row)
std::string policy::LabelCachePolicy::key( const sqlite::Row& row )
{
return row.load<KeyType>( 1 );
}
......@@ -45,7 +45,7 @@ struct LabelCachePolicy
{
typedef std::string KeyType;
static const std::string& key(const ILabel* self );
static std::string key( sqlite::Row& row );
static std::string key( const sqlite::Row& row );
};
}
......
......@@ -353,7 +353,7 @@ const std::string& policy::MediaCache::key( const IMedia* self )
return self->mrl();
}
std::string policy::MediaCache::key(sqlite::Row& row)
std::string policy::MediaCache::key( const sqlite::Row& row )
{
return row.load<std::string>( 5 );
}
......@@ -53,7 +53,7 @@ struct MediaCache
{
typedef std::string KeyType;
static const std::string& key(const IMedia* self);
static std::string key( sqlite::Row& row );
static std::string key( const sqlite::Row& row );
};
}
......
......@@ -40,7 +40,7 @@ class PrimaryKeyCacheKeyPolicy
{
return self->id();
}
static unsigned int key( sqlite::Row& row )
static unsigned int key( const sqlite::Row& row )
{
return row.load<unsigned int>( 0 );
}
......
......@@ -74,7 +74,7 @@ public:
* @brief Returns the value in column idx, but doesn't advance to the next column
*/
template <typename T>
T load(unsigned int idx)
T load(unsigned int idx) const
{
if ( m_idx + 1 > m_nbColumns )
throw errors::ColumnOutOfRange( m_idx, m_nbColumns );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment