Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
medialibrary
Commits
9ecfc564
Commit
9ecfc564
authored
Apr 24, 2018
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Media: Ensure subType isn't null
parent
486900fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
src/Media.cpp
src/Media.cpp
+3
-1
src/database/migrations/migration13-14.sql
src/database/migrations/migration13-14.sql
+7
-2
No files found.
src/Media.cpp
View file @
9ecfc564
...
...
@@ -571,7 +571,9 @@ void Media::createTable( sqlite::Connection* connection )
std
::
string
req
=
"CREATE TABLE IF NOT EXISTS "
+
policy
::
MediaTable
::
Name
+
"("
"id_media INTEGER PRIMARY KEY AUTOINCREMENT,"
"type INTEGER,"
"subtype INTEGER,"
"subtype INTEGER NOT NULL DEFAULT "
+
std
::
to_string
(
static_cast
<
typename
std
::
underlying_type
<
IMedia
::
SubType
>::
type
>
(
IMedia
::
SubType
::
Unknown
)
)
+
","
"duration INTEGER DEFAULT -1,"
"play_count UNSIGNED INTEGER,"
"last_played_date UNSIGNED INTEGER,"
...
...
src/database/migrations/migration13-14.sql
View file @
9ecfc564
...
...
@@ -27,7 +27,9 @@
"CREATE TABLE "
+
MediaTable
::
Name
+
"("
"id_media INTEGER PRIMARY KEY AUTOINCREMENT,"
"type INTEGER,"
"subtype INTEGER,"
"subtype INTEGER NOT NULL DEFAULT "
+
std
::
to_string
(
static_cast
<
typename
std
::
underlying_type
<
IMedia
::
SubType
>
::
type
>
(
IMedia
::
SubType
::
Unknown
)
)
+
","
"duration INTEGER DEFAULT -1,"
"play_count UNSIGNED INTEGER,"
"last_played_date UNSIGNED INTEGER,"
...
...
@@ -47,7 +49,10 @@
"id_media, type, subtype, duration, play_count, last_played_date, insertion_date,"
"release_date, thumbnail_id, thumbnail_generated, title, filename, is_favorite,"
"is_present) "
"SELECT id_media, type, subtype, duration, play_count, last_played_date,"
"SELECT id_media, type, ifnull(subtype, "
+
std
::
to_string
(
static_cast
<
typename
std
::
underlying_type
<
IMedia
::
SubType
>
::
type
>
(
IMedia
::
SubType
::
Unknown
)
)
+
"), duration, play_count, last_played_date,"
"insertion_date, release_date, "
"CASE thumbnail WHEN NULL THEN 0 WHEN '' THEN 0 ELSE id_media END,"
"CASE thumbnail WHEN NULL THEN 0 WHEN '' THEN 0 ELSE 1 END,"
...
...
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