Merge "res_pjsip: Fix mwi_subscribe_replaces_unsolicited type mismatch"
[asterisk/asterisk.git] / addons / res_config_mysql.c
index f2ef949..edd9385 100644 (file)
@@ -33,7 +33,6 @@
 #include <sys/stat.h>
 
 #include <mysql/mysql.h>
-#include <mysql/mysql_version.h>
 #include <mysql/errmsg.h>
 
 #include "asterisk/channel.h"
@@ -447,7 +446,7 @@ static struct ast_config *realtime_multi_mysql(const char *database, const char
                release_database(dbh);
                return NULL;
        }
-       
+
        if (!(cfg = ast_config_new())) {
                /* If I can't alloc memory at this point, why bother doing anything else? */
                ast_log(LOG_WARNING, "Out of memory!\n");
@@ -523,9 +522,8 @@ static struct ast_config *realtime_multi_mysql(const char *database, const char
 
                while ((row = mysql_fetch_row(result))) {
                        var = NULL;
-                       cat = ast_category_new("", "", -1);
+                       cat = ast_category_new_anonymous();
                        if (!cat) {
-                               ast_log(LOG_WARNING, "Out of memory!\n");
                                continue;
                        }
                        for (i = 0; i < numFields; i++) {
@@ -750,7 +748,7 @@ static int update2_mysql(const char *database, const char *tablename, const stru
 
        return (int)numrows;
 }
+
 static int store_mysql(const char *database, const char *table, const struct ast_variable *rt_fields)
 {
        struct mysql_conn *dbh;
@@ -874,7 +872,7 @@ static int destroy_mysql(const char *database, const char *table, const char *ke
 
        return (int)numrows;
 }
+
 static struct ast_config *config_mysql(const char *database, const char *table, const char *file, struct ast_config *cfg, struct ast_flags config_flags, const char *unused, const char *who_asked)
 {
        struct mysql_conn *dbh;
@@ -934,8 +932,8 @@ static struct ast_config *config_mysql(const char *database, const char *table,
                        }
 
                        if (strcmp(last, row[0]) || last_cat_metric != atoi(row[3])) {
-                               if (!(cur_cat = ast_category_new(row[0], "", -1))) {
-                                       ast_log(LOG_WARNING, "Out of memory!\n");
+                               cur_cat = ast_category_new_dynamic(row[0]);
+                               if (!cur_cat) {
                                        break;
                                }
                                strcpy(last, row[0]);
@@ -1561,5 +1559,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "MySQL RealTime Config
        .unload = unload_module,
        .reload = reload,
        .load_pri = AST_MODPRI_REALTIME_DRIVER,
+       .requires = "extconfig",
 );
-