]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - mysql_selector.c
the paraslash-0.2.11 release tarball
[paraslash.git] / mysql_selector.c
index 85d16ee200dc9c7bf032aac790894dabee5a710f..b51f4f079c82cf12994e9f91f0fb553769983932 100644 (file)
@@ -93,7 +93,7 @@ static struct server_command cmds[] = {
 
 "\tCreate database name containing the initial columns for basic\n"
 "\tinteroperation with server. This command has to be used only once\n"
 
 "\tCreate database name containing the initial columns for basic\n"
 "\tinteroperation with server. This command has to be used only once\n"
-"\twhen you use the mysql database tool for the very first time.\n"
+"\twhen you use the mysql audio file selector for the very first time.\n"
 "\n"
 "\tThe optional name defaults to 'paraslash' if not given.\n"
 
 "\n"
 "\tThe optional name defaults to 'paraslash' if not given.\n"
 
@@ -212,7 +212,7 @@ static struct server_command cmds[] = {
 .help =
 
 "\tIf pattern was not given, print list of all audio files known\n"
 .help =
 
 "\tIf pattern was not given, print list of all audio files known\n"
-"\tto the mysql database tool. See the documentation of mysql\n"
+"\tto the mysql selector. See the documentation of mysql\n"
 "\tfor the definition of LIKE patterns.\n"
 
 },
 "\tfor the definition of LIKE patterns.\n"
 
 },
@@ -1248,7 +1248,7 @@ out:
  * This is called from server and from some commands. Name must not be NULL
  * Never returns NULL.
  */
  * This is called from server and from some commands. Name must not be NULL
  * Never returns NULL.
  */
-static char *get_dbinfo(char *name)
+static char *get_selector_info(char *name)
 {
        char *meta = NULL, *atts = NULL, *info, *dir = NULL, *query, *stream = NULL;
        void *result = NULL;
 {
        char *meta = NULL, *atts = NULL, *info, *dir = NULL, *query, *stream = NULL;
        void *result = NULL;
@@ -1807,14 +1807,14 @@ out:
 static void update_mmd(char *info)
 {
        PARA_DEBUG_LOG("%s", "updating shared memory area\n");
 static void update_mmd(char *info)
 {
        PARA_DEBUG_LOG("%s", "updating shared memory area\n");
-       strncpy(mmd->dbinfo, info, MMD_INFO_SIZE - 1);
-       mmd->dbinfo[MMD_INFO_SIZE - 1] = '\0';
+       strncpy(mmd->selector_info, info, MMD_INFO_SIZE - 1);
+       mmd->selector_info[MMD_INFO_SIZE - 1] = '\0';
 }
 
 static void update_audio_file_server_handler(char *name)
 {
        char *info;
 }
 
 static void update_audio_file_server_handler(char *name)
 {
        char *info;
-       info = get_dbinfo(name);
+       info = get_selector_info(name);
        update_mmd(info);
        free(info);
        update_audio_file(name);
        update_mmd(info);
        free(info);
        update_audio_file(name);
@@ -1827,14 +1827,14 @@ static int com_us(__unused int fd, int argc, char *argv[])
        return update_audio_file(argv[1]);
 }
 
        return update_audio_file(argv[1]);
 }
 
-static void refresh_mmd_dbinfo(void)
+static void refresh_selector_info(void)
 {
        char *name = get_current_audio_file();
        char *info;
 
        if (!name)
                return;
 {
        char *name = get_current_audio_file();
        char *info;
 
        if (!name)
                return;
-       info = get_dbinfo(name);
+       info = get_selector_info(name);
        free(name);
        mmd_lock();
        update_mmd(info);
        free(name);
        mmd_lock();
        update_mmd(info);
@@ -1901,7 +1901,7 @@ static int com_ps(__unused int fd, int argc, char *argv[])
                "'current_stream'", row[0]);
        ret = real_query(query);
        free(query);
                "'current_stream'", row[0]);
        ret = real_query(query);
        free(query);
-       refresh_mmd_dbinfo();
+       refresh_selector_info();
 out:
        free(stream);
        if (result)
 out:
        free(stream);
        if (result)
@@ -2009,7 +2009,7 @@ static int com_cs(int fd, int argc, char *argv[])
                ret = change_stream(argv[1]);
                if (ret < 0)
                        goto out;
                ret = change_stream(argv[1]);
                if (ret < 0)
                        goto out;
-               refresh_mmd_dbinfo();
+               refresh_selector_info();
        }
        if (csp) {
                mmd_lock();
        }
        if (csp) {
                mmd_lock();
@@ -2148,7 +2148,7 @@ no_more_atts:
                for (; argv[i] && ret >= 0; i++)
                        ret = update_atts(fd, argv[i], atts);
        }
                for (; argv[i] && ret >= 0; i++)
                        ret = update_atts(fd, argv[i], atts);
        }
-       refresh_mmd_dbinfo();
+       refresh_selector_info();
 out:
        return ret;
 }
 out:
        return ret;
 }
@@ -2427,7 +2427,7 @@ static int init_mysql_server(void)
 /* mmd lock must be held */
 static void write_msg2mmd(int success)
 {
 /* mmd lock must be held */
 static void write_msg2mmd(int success)
 {
-       sprintf(mmd->dbinfo, "dbinfo1:%s\ndbinfo2:mysql-%s\ndbinfo3:\n",
+       sprintf(mmd->selector_info, "dbinfo1:%s\ndbinfo2:mysql-%s\ndbinfo3:\n",
                success < 0? PARA_STRERROR(-success) :
                        "successfully connected to mysql server",
                success < 0? "" : mysql_get_server_info(mysql_ptr));
                success < 0? PARA_STRERROR(-success) :
                        "successfully connected to mysql server",
                success < 0? "" : mysql_get_server_info(mysql_ptr));
@@ -2509,12 +2509,13 @@ static void shutdown_connection(void)
 }
 
 /**
 }
 
 /**
- * the init function of the mysql-based database tool
+ * the init function of the mysql-based audio file selector
  *
  * Check the command line options and initialize all function pointers of \a db.
  *
  * Check the command line options and initialize all function pointers of \a db.
- * Connect to the mysql server and initialize the dbinfo string.
+ * Connect to the mysql server and initialize the info string.
  *
  *
- * \sa struct audio_file_selector, misc_meta_data::dbinfo, random_selector.c
+ * \sa struct audio_file_selector, misc_meta_data::selector_info,
+ * random_selector.c
  */
 int mysql_selector_init(struct audio_file_selector *db)
 {
  */
 int mysql_selector_init(struct audio_file_selector *db)
 {