Fix error messages in smart playlists, and verify updated clauses on edit

This commit is contained in:
Ron Pedde 2006-06-30 05:33:35 +00:00
parent 5a915cbe84
commit 534005fb70
2 changed files with 15 additions and 1 deletions

View File

@ -537,6 +537,8 @@ int db_sql_edit_playlist(char **pe, int id, char *name, char *clause) {
int result;
int playlist_type;
int dup_id=id;
char *criteria;
char *estring;
if((name == NULL) && (clause == NULL))
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;
}
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 */
if(name) {
result = db_sql_fetch_int(pe,&dup_id,"select id from playlists "

View File

@ -749,7 +749,9 @@ SP_NODE *sp_parse_phrase(PARSETREE tree) {
expr = sp_parse_oexpr(tree);
if((!expr) || (tree->token.token_id != T_EOF)) {
sp_set_error(tree,SP_E_EOS);
if(!tree->error) {
sp_set_error(tree,SP_E_EOS);
}
sp_free_node(expr);
expr = NULL;
}