Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
medialibrary
Commits
a62f96a4
Commit
a62f96a4
authored
Oct 01, 2015
by
Hugo Beauzée-Luyssen
Browse files
File: Create the file with a default filename
parent
0e93d967
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/File.cpp
View file @
a62f96a4
...
...
@@ -38,7 +38,7 @@ File::File( DBConnection dbConnection, sqlite3_stmt* stmt )
m_name
=
sqlite
::
Traits
<
std
::
string
>::
Load
(
stmt
,
12
);
}
File
::
File
(
const
fs
::
IFile
*
file
,
unsigned
int
folderId
)
File
::
File
(
const
fs
::
IFile
*
file
,
unsigned
int
folderId
,
const
std
::
string
&
name
)
:
m_id
(
0
)
,
m_type
(
Type
::
UnknownType
)
,
m_duration
(
0
)
...
...
@@ -50,17 +50,19 @@ File::File( const fs::IFile* file, unsigned int folderId )
,
m_folderId
(
folderId
)
,
m_lastModificationDate
(
file
->
lastModificationDate
()
)
,
m_isParsed
(
false
)
,
m_name
(
name
)
{
}
//FIXME: Pass the guessed type and default name
FilePtr
File
::
create
(
DBConnection
dbConnection
,
const
fs
::
IFile
*
file
,
unsigned
int
folderId
)
{
auto
self
=
std
::
make_shared
<
File
>
(
file
,
folderId
);
auto
self
=
std
::
make_shared
<
File
>
(
file
,
folderId
,
file
->
name
()
);
static
const
std
::
string
req
=
"INSERT INTO "
+
policy
::
FileTable
::
Name
+
"(mrl, folder_id, last_modification_date) VALUES(?, ?, ?)"
;
"(mrl, folder_id, last_modification_date
, name
) VALUES(?, ?,
?,
?)"
;
if
(
_Cache
::
insert
(
dbConnection
,
self
,
req
,
self
->
m_mrl
,
sqlite
::
ForeignKey
(
folderId
),
self
->
m_lastModificationDate
)
==
false
)
if
(
_Cache
::
insert
(
dbConnection
,
self
,
req
,
self
->
m_mrl
,
sqlite
::
ForeignKey
(
folderId
),
self
->
m_lastModificationDate
,
self
->
m_name
)
==
false
)
return
nullptr
;
self
->
m_dbConnection
=
dbConnection
;
return
self
;
...
...
src/File.h
View file @
a62f96a4
...
...
@@ -40,7 +40,7 @@ class File : public IFile, public Cache<File, IFile, policy::FileTable, policy::
// shall be well-formed, and private constructor would prevent that.
// There might be a way with a user-defined allocator, but we'll see that later...
File
(
DBConnection
dbConnection
,
sqlite3_stmt
*
stmt
);
File
(
const
fs
::
IFile
*
file
,
unsigned
int
folderId
);
File
(
const
fs
::
IFile
*
file
,
unsigned
int
folderId
,
const
std
::
string
&
name
);
static
FilePtr
create
(
DBConnection
dbConnection
,
const
fs
::
IFile
*
file
,
unsigned
int
folderId
);
static
bool
createTable
(
DBConnection
connection
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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