*/
static char *get_selector_info(char *name)
{
- char *meta = NULL, *atts = NULL, *info, *dir = NULL, *query, *stream = NULL;
+ char *meta, *atts, *info, *dir, *query, *stream;
void *result = NULL;
MYSQL_ROW row = NULL;
stream, meta,
(result && row && row[0])? row[0] : "(no score)",
atts);
- if (dir)
- free(dir);
- if (meta)
- free(meta);
- if (atts)
- free(atts);
- if (stream)
- free(stream);
+ free(dir);
+ free(meta);
+ free(atts);
+ free(stream);
if (result)
mysql_free_result(result);
return info;
/**
* the init function of the mysql-based audio file selector
*
- * Check the command line options and initialize all function pointers of \a db.
- * Connect to the mysql server and initialize the info string.
+ * \param db pointer to the struct to initialize
+ *
+ * Check the command line options and initialize all function pointers of \a
+ * db. Connect to the mysql server and initialize the info string.
+ *
+ * \return This function returns success even if it could not connect
+ * to the mysql server. This is because the connect is expected to fail
+ * if there the paraslash database is not yet created. This gives the
+ * user a chance to send the "cdb" to create the database.
*
* \sa struct audio_file_selector, misc_meta_data::selector_info,
* random_selector.c
if (!conf.mysql_audio_file_dir_given)
return -E_NO_AF_DIR;
db->name = "mysql";
- db->cmd_list = cmds;
+ db->cmd_list = mysql_selector_cmds;
db->get_audio_file_list = server_get_audio_file_list;
db->update_audio_file = update_audio_file_server_handler;
db->shutdown = shutdown_connection;