Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
medialibrary
Commits
97feb81c
Commit
97feb81c
authored
Feb 23, 2018
by
Hugo Beauzée-Luyssen
Browse files
Media: Move index creation in createTriggers
parent
0fb1f285
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Media.cpp
View file @
97feb81c
...
...
@@ -535,8 +535,7 @@ void Media::createTable( sqlite::Connection* connection )
"is_favorite BOOLEAN NOT NULL DEFAULT 0,"
"is_present BOOLEAN NOT NULL DEFAULT 1"
")"
;
const
std
::
string
indexReq
=
"CREATE INDEX IF NOT EXISTS index_last_played_date ON "
+
policy
::
MediaTable
::
Name
+
"(last_played_date DESC)"
;
const
std
::
string
vtableReq
=
"CREATE VIRTUAL TABLE IF NOT EXISTS "
+
policy
::
MediaTable
::
Name
+
"Fts USING FTS3("
"title,"
...
...
@@ -549,13 +548,14 @@ void Media::createTable( sqlite::Connection* connection )
"PRIMARY KEY (id_media, type)"
")"
;
sqlite
::
Tools
::
executeRequest
(
connection
,
req
);
sqlite
::
Tools
::
executeRequest
(
connection
,
indexReq
);
sqlite
::
Tools
::
executeRequest
(
connection
,
vtableReq
);
sqlite
::
Tools
::
executeRequest
(
connection
,
metadataReq
);
}
void
Media
::
createTriggers
(
sqlite
::
Connection
*
connection
)
{
const
std
::
string
indexReq
=
"CREATE INDEX IF NOT EXISTS index_last_played_date ON "
+
policy
::
MediaTable
::
Name
+
"(last_played_date DESC)"
;
static
const
std
::
string
triggerReq
=
"CREATE TRIGGER IF NOT EXISTS has_files_present AFTER UPDATE OF "
"is_present ON "
+
policy
::
FileTable
::
Name
+
" BEGIN "
...
...
@@ -589,6 +589,8 @@ void Media::createTriggers( sqlite::Connection* connection )
" BEGIN"
" UPDATE "
+
policy
::
MediaTable
::
Name
+
"Fts SET title = new.title WHERE rowid = new.id_media;"
" END"
;
sqlite
::
Tools
::
executeRequest
(
connection
,
indexReq
);
sqlite
::
Tools
::
executeRequest
(
connection
,
triggerReq
);
sqlite
::
Tools
::
executeRequest
(
connection
,
triggerReq2
);
sqlite
::
Tools
::
executeRequest
(
connection
,
vtableInsertTrigger
);
...
...
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