Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
91729437
Commit
91729437
authored
Feb 17, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Main: initialize Database before Storage
parent
3af7af0b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
19 deletions
+14
-19
Main.cxx
src/Main.cxx
+12
-5
Configured.cxx
src/db/Configured.cxx
+1
-13
Configured.hxx
src/db/Configured.hxx
+1
-1
No files found.
src/Main.cxx
View file @
91729437
...
@@ -172,7 +172,6 @@ glue_db_init_and_load(void)
...
@@ -172,7 +172,6 @@ glue_db_init_and_load(void)
Error
error
;
Error
error
;
instance
->
database
=
instance
->
database
=
CreateConfiguredDatabase
(
*
instance
->
event_loop
,
*
instance
,
CreateConfiguredDatabase
(
*
instance
->
event_loop
,
*
instance
,
instance
->
storage
!=
nullptr
,
is_simple
,
error
);
is_simple
,
error
);
if
(
instance
->
database
==
nullptr
)
{
if
(
instance
->
database
==
nullptr
)
{
if
(
error
.
IsDefined
())
if
(
error
.
IsDefined
())
...
@@ -181,6 +180,18 @@ glue_db_init_and_load(void)
...
@@ -181,6 +180,18 @@ glue_db_init_and_load(void)
return
true
;
return
true
;
}
}
if
(
!
InitStorage
(
error
))
FatalError
(
error
);
if
(
instance
->
storage
==
nullptr
)
{
delete
instance
->
database
;
instance
->
database
=
nullptr
;
LogDefault
(
config_domain
,
"Found database setting without "
"music_directory - disabling database"
);
return
true
;
}
if
(
!
instance
->
database
->
Open
(
error
))
if
(
!
instance
->
database
->
Open
(
error
))
FatalError
(
error
);
FatalError
(
error
);
...
@@ -199,10 +210,6 @@ glue_db_init_and_load(void)
...
@@ -199,10 +210,6 @@ glue_db_init_and_load(void)
static
bool
static
bool
InitDatabaseAndStorage
()
InitDatabaseAndStorage
()
{
{
Error
error
;
if
(
!
InitStorage
(
error
))
FatalError
(
error
);
const
bool
create_db
=
!
glue_db_init_and_load
();
const
bool
create_db
=
!
glue_db_init_and_load
();
return
create_db
;
return
create_db
;
}
}
...
...
src/db/Configured.cxx
View file @
91729437
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
Database
*
Database
*
CreateConfiguredDatabase
(
EventLoop
&
loop
,
DatabaseListener
&
listener
,
CreateConfiguredDatabase
(
EventLoop
&
loop
,
DatabaseListener
&
listener
,
bool
have_storage
,
bool
&
is_simple_r
,
Error
&
error
)
bool
&
is_simple_r
,
Error
&
error
)
{
{
const
struct
config_param
*
param
=
config_get_param
(
CONF_DATABASE
);
const
struct
config_param
*
param
=
config_get_param
(
CONF_DATABASE
);
const
struct
config_param
*
path
=
config_get_param
(
CONF_DB_FILE
);
const
struct
config_param
*
path
=
config_get_param
(
CONF_DB_FILE
);
...
@@ -40,18 +40,6 @@ CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener,
...
@@ -40,18 +40,6 @@ CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener,
return
nullptr
;
return
nullptr
;
}
}
if
(
!
have_storage
)
{
if
(
param
!=
nullptr
)
LogDefault
(
config_domain
,
"Found database setting without "
"music_directory - disabling database"
);
if
(
path
!=
nullptr
)
LogDefault
(
config_domain
,
"Found db_file setting without "
"music_directory - disabling database"
);
return
nullptr
;
}
struct
config_param
*
allocated
=
nullptr
;
struct
config_param
*
allocated
=
nullptr
;
if
(
param
==
nullptr
&&
path
!=
nullptr
)
{
if
(
param
==
nullptr
&&
path
!=
nullptr
)
{
...
...
src/db/Configured.hxx
View file @
91729437
...
@@ -34,6 +34,6 @@ class Error;
...
@@ -34,6 +34,6 @@ class Error;
*/
*/
Database
*
Database
*
CreateConfiguredDatabase
(
EventLoop
&
loop
,
DatabaseListener
&
listener
,
CreateConfiguredDatabase
(
EventLoop
&
loop
,
DatabaseListener
&
listener
,
bool
have_storage
,
bool
&
is_simple_r
,
Error
&
error
);
bool
&
is_simple_r
,
Error
&
error
);
#endif
#endif
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