return ret;
}
-/* get attributes by name. If verbose is not 0, get_a writes a string
- * into atts of the form 'att1="0",att2="1"', which is used in com_cam
- * for contructing a mysql update query.
- * never returns NULL in *NON VERBOSE* mode
+/*
+ * get attributes by name. If verbose is not 0, this function returns a string
+ * of the form 'att1="0",att2="1"'... which is used in com_cam() for
+ * constructing a mysql update query. Otherwise the space-separated list of all
+ * attributes which are set in the audio file given by name is returned. Never
+ * returns NULL in *NON VERBOSE* mode.
*/
static char *get_atts(char *name, int verbose)
{
char *atts = NULL, *buf, *ebn;
void *result = NULL, *result2 = NULL;
MYSQL_ROW row, row2;
- int i, ret;
- unsigned int num_fields;
+ int i;
+ unsigned num_fields;
- ret = -E_NOATTS;
result2 = get_all_attributes();
if (!result2)
goto out;
- ret = -E_ESCAPE;
- if (!(ebn = escaped_basename(name)))
+ ebn = escaped_basename(name);
+ if (!ebn)
goto out;
buf = make_message("select * from data where name='%s'", ebn);
free(ebn);
- ret = -E_NORESULT;
result = get_result(buf);
free(buf);
if (!result)
goto out;
- ret = -E_EMPTY_RESULT;
num_fields = mysql_num_fields(result);
if (num_fields < 5)
goto out;
mysql_data_seek(result2, 4); /* skip Lastplayed, Numplayed... */
row = mysql_fetch_row(result);
- ret = -E_NOROW;
if (!row)
goto out;
for (i = 4; i < num_fields; i++) {
if (verbose)
atts = para_strcat(atts, is_set? "=\"1\"" : "=\"0\"");
}
- ret = 1;
out:
if (result2)
mysql_free_result(result2);