Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
medialibrary
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
56
Issues
56
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
medialibrary
Commits
3661fb88
Commit
3661fb88
authored
May 17, 2014
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache label by value instead of primary key
parent
b6a7492c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
src/Label.cpp
src/Label.cpp
+12
-1
src/Label.h
src/Label.h
+10
-1
No files found.
src/Label.cpp
View file @
3661fb88
...
...
@@ -7,7 +7,7 @@
#include "SqliteTools.h"
const
std
::
string
policy
::
LabelTable
::
Name
=
"Label"
;
const
std
::
string
policy
::
LabelTable
::
CacheColumn
=
"
id_label
"
;
const
std
::
string
policy
::
LabelTable
::
CacheColumn
=
"
name
"
;
Label
::
Label
(
sqlite3
*
dbConnection
,
sqlite3_stmt
*
stmt
)
:
m_dbConnection
(
dbConnection
)
...
...
@@ -86,3 +86,14 @@ bool Label::createTable(sqlite3* dbConnection)
return
SqliteTools
::
createTable
(
dbConnection
,
req
.
c_str
()
);
}
const
std
::
string
&
policy
::
LabelCachePolicy
::
key
(
const
std
::
shared_ptr
<
Label
>
self
)
{
return
self
->
name
();
}
std
::
string
policy
::
LabelCachePolicy
::
key
(
sqlite3_stmt
*
stmt
)
{
return
Traits
<
KeyType
>::
Load
(
stmt
,
1
);
}
src/Label.h
View file @
3661fb88
...
...
@@ -5,6 +5,7 @@
#include <string>
class
File
;
class
Label
;
#include "ILabel.h"
#include "Cache.h"
...
...
@@ -16,9 +17,17 @@ struct LabelTable
static
const
std
::
string
Name
;
static
const
std
::
string
CacheColumn
;
};
struct
LabelCachePolicy
{
typedef
std
::
string
KeyType
;
static
const
std
::
string
&
key
(
const
std
::
shared_ptr
<
Label
>
self
);
static
std
::
string
key
(
sqlite3_stmt
*
stmt
);
};
}
class
Label
:
public
ILabel
,
public
Cache
<
Label
,
ILabel
,
policy
::
LabelTable
>
class
Label
:
public
ILabel
,
public
Cache
<
Label
,
ILabel
,
policy
::
LabelTable
,
policy
::
LabelCachePolicy
>
{
public:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment