This code was in team/murf/bug8684-trunk; it should fix bug 8684 in trunk. I didn't add it to 1.4 yet, because it's not entirely clear to me if this is a bug fix or an enhancement. A lot of files were affected by small changes like ast_variable_new getting an added arg, for the file name the var was defined in; ast_category_new gets added args of filename and lineno; ast_category and ast_variable structures now record file and lineno for each entry; a list of all #include and #execs in a config file (or any of its inclusions are now kept in the ast_config struct; at save time, each entry is put back into its proper file of origin, in order. #include and #exec directives are folded in properly. Headers indicating that the file was generated, are generated also for each included file. Some changes to main/manager.c to take care of file renaming, via the UpdateConfig command. Multiple inclusions of the same file are handled by exploding these into multiple include files, uniquely named. There's probably more, but I can't remember it right now.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81361 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Steve Murphy
2007-08-29 20:55:40 +00:00
parent 8a6c04a0a9
commit b5cd67adc3
18 changed files with 807 additions and 234 deletions

View File

@@ -219,11 +219,11 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl
chunk = strsep(&stringp, ";");
if (!ast_strlen_zero(ast_strip(chunk))) {
if (prev) {
prev->next = ast_variable_new(coltitle, chunk);
prev->next = ast_variable_new(coltitle, chunk, "");
if (prev->next)
prev = prev->next;
} else
prev = var = ast_variable_new(coltitle, chunk);
prev = var = ast_variable_new(coltitle, chunk, "");
}
}
}
@@ -334,7 +334,7 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char *
ast_log(LOG_WARNING, "SQL Fetch error!\n[%s]\n\n", sql);
continue;
}
cat = ast_category_new("");
cat = ast_category_new("","",99999);
if (!cat) {
ast_log(LOG_WARNING, "Out of memory!\n");
continue;
@@ -366,7 +366,7 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char *
if (!ast_strlen_zero(ast_strip(chunk))) {
if (initfield && !strcmp(initfield, coltitle))
ast_category_rename(cat, chunk);
var = ast_variable_new(coltitle, chunk);
var = ast_variable_new(coltitle, chunk, "");
ast_variable_append(cat, var);
}
}
@@ -625,7 +625,7 @@ static SQLHSTMT config_odbc_prepare(struct odbc_obj *obj, void *data)
return sth;
}
static struct ast_config *config_odbc(const char *database, const char *table, const char *file, struct ast_config *cfg, struct ast_flags flags)
static struct ast_config *config_odbc(const char *database, const char *table, const char *file, struct ast_config *cfg, struct ast_flags flags, const char *sugg_incl)
{
struct ast_variable *new_v;
struct ast_category *cur_cat;
@@ -682,7 +682,7 @@ static struct ast_config *config_odbc(const char *database, const char *table, c
while ((res = SQLFetch(stmt)) != SQL_NO_DATA) {
if (!strcmp (q.var_name, "#include")) {
if (!ast_config_internal_load(q.var_val, cfg, loader_flags)) {
if (!ast_config_internal_load(q.var_val, cfg, loader_flags, "")) {
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
return NULL;
@@ -690,7 +690,7 @@ static struct ast_config *config_odbc(const char *database, const char *table, c
continue;
}
if (strcmp(last, q.category) || last_cat_metric != q.cat_metric) {
cur_cat = ast_category_new(q.category);
cur_cat = ast_category_new(q.category, "", 99999);
if (!cur_cat) {
ast_log(LOG_WARNING, "Out of memory!\n");
break;
@@ -700,7 +700,7 @@ static struct ast_config *config_odbc(const char *database, const char *table, c
ast_category_append(cfg, cur_cat);
}
new_v = ast_variable_new(q.var_name, q.var_val);
new_v = ast_variable_new(q.var_name, q.var_val, "");
ast_variable_append(cur_cat, new_v);
}