mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-01 10:13:45 -04:00
Fix error messages in smart playlists, and verify updated clauses on edit
This commit is contained in:
parent
5a915cbe84
commit
534005fb70
12
src/db-sql.c
12
src/db-sql.c
@ -537,6 +537,8 @@ int db_sql_edit_playlist(char **pe, int id, char *name, char *clause) {
|
|||||||
int result;
|
int result;
|
||||||
int playlist_type;
|
int playlist_type;
|
||||||
int dup_id=id;
|
int dup_id=id;
|
||||||
|
char *criteria;
|
||||||
|
char *estring;
|
||||||
|
|
||||||
if((name == NULL) && (clause == NULL))
|
if((name == NULL) && (clause == NULL))
|
||||||
return DB_E_SUCCESS; /* I guess?? */
|
return DB_E_SUCCESS; /* I guess?? */
|
||||||
@ -559,6 +561,16 @@ int db_sql_edit_playlist(char **pe, int id, char *name, char *clause) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if((playlist_type == PL_SMART) && (clause)) {
|
||||||
|
if(!db_sql_parse_smart(&estring,&criteria,clause)) {
|
||||||
|
db_get_error(pe,DB_E_PARSE,estring);
|
||||||
|
free(estring);
|
||||||
|
return DB_E_PARSE;
|
||||||
|
}
|
||||||
|
free(criteria);
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO: check for duplicate names here */
|
/* TODO: check for duplicate names here */
|
||||||
if(name) {
|
if(name) {
|
||||||
result = db_sql_fetch_int(pe,&dup_id,"select id from playlists "
|
result = db_sql_fetch_int(pe,&dup_id,"select id from playlists "
|
||||||
|
@ -749,7 +749,9 @@ SP_NODE *sp_parse_phrase(PARSETREE tree) {
|
|||||||
|
|
||||||
expr = sp_parse_oexpr(tree);
|
expr = sp_parse_oexpr(tree);
|
||||||
if((!expr) || (tree->token.token_id != T_EOF)) {
|
if((!expr) || (tree->token.token_id != T_EOF)) {
|
||||||
|
if(!tree->error) {
|
||||||
sp_set_error(tree,SP_E_EOS);
|
sp_set_error(tree,SP_E_EOS);
|
||||||
|
}
|
||||||
sp_free_node(expr);
|
sp_free_node(expr);
|
||||||
expr = NULL;
|
expr = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user