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
a2e3dc05
Commit
a2e3dc05
authored
Oct 29, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/Interface: migrate Update() from class Error to C++ exceptions
parent
df142d4f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
16 deletions
+10
-16
OtherCommands.cxx
src/command/OtherCommands.cxx
+1
-5
Interface.hxx
src/db/Interface.hxx
+7
-7
ProxyDatabasePlugin.cxx
src/db/plugins/ProxyDatabasePlugin.cxx
+2
-4
No files found.
src/command/OtherCommands.cxx
View file @
a2e3dc05
...
...
@@ -36,7 +36,6 @@
#include "ls.hxx"
#include "mixer/Volume.hxx"
#include "util/UriUtil.hxx"
#include "util/Error.hxx"
#include "util/StringAPI.hxx"
#include "fs/AllocatedPath.hxx"
#include "Stats.hxx"
...
...
@@ -277,13 +276,10 @@ static CommandResult
handle_update
(
Response
&
r
,
Database
&
db
,
const
char
*
uri_utf8
,
bool
discard
)
{
Error
error
;
unsigned
id
=
db
.
Update
(
uri_utf8
,
discard
,
error
);
unsigned
id
=
db
.
Update
(
uri_utf8
,
discard
);
if
(
id
>
0
)
{
r
.
Format
(
"updating_db: %i
\n
"
,
id
);
return
CommandResult
::
OK
;
}
else
if
(
error
.
IsDefined
())
{
return
print_error
(
r
,
error
);
}
else
{
/* Database::Update() has returned 0 without setting
the Error: the method is not implemented */
...
...
src/db/Interface.hxx
View file @
a2e3dc05
...
...
@@ -31,7 +31,6 @@ struct DatabasePlugin;
struct
DatabaseStats
;
struct
DatabaseSelection
;
struct
LightSong
;
class
Error
;
class
Database
{
const
DatabasePlugin
&
plugin
;
...
...
@@ -111,14 +110,15 @@ public:
virtual
DatabaseStats
GetStats
(
const
DatabaseSelection
&
selection
)
const
=
0
;
/**
* Update the database. Returns the job id on success, 0 on
* error (with #Error set) and 0 if not implemented (#Error
* not set).
* Update the database.
*
* Throws #std::runtime_error on error.
*
* @return the job id or 0 if not implemented
*/
virtual
unsigned
Update
(
gcc_unused
const
char
*
uri_utf8
,
gcc_unused
bool
discard
,
gcc_unused
Error
&
error
)
{
/* not implemented: return 0 and don't set an Error */
gcc_unused
bool
discard
)
{
/* not implemented: return 0 */
return
0
;
}
...
...
src/db/plugins/ProxyDatabasePlugin.cxx
View file @
a2e3dc05
...
...
@@ -124,8 +124,7 @@ public:
DatabaseStats
GetStats
(
const
DatabaseSelection
&
selection
)
const
override
;
virtual
unsigned
Update
(
const
char
*
uri_utf8
,
bool
discard
,
Error
&
error
)
override
;
unsigned
Update
(
const
char
*
uri_utf8
,
bool
discard
)
override
;
virtual
time_t
GetUpdateStamp
()
const
override
{
return
update_stamp
;
...
...
@@ -820,8 +819,7 @@ ProxyDatabase::GetStats(const DatabaseSelection &selection) const
}
unsigned
ProxyDatabase
::
Update
(
const
char
*
uri_utf8
,
bool
discard
,
gcc_unused
Error
&
error
)
ProxyDatabase
::
Update
(
const
char
*
uri_utf8
,
bool
discard
)
{
EnsureConnected
();
...
...
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