diff options
author | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-08-29 20:55:40 +0000 |
---|---|---|
committer | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-08-29 20:55:40 +0000 |
commit | 88e10708c5ba8158ee4fdf1aa08585739125b5da (patch) | |
tree | d08154c0eafb287f12d6b28ce99eea6938c21ce8 /res/res_config_pgsql.c | |
parent | 2149521341f36fb9f90d61796969f2665daca309 (diff) |
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: http://svn.digium.com/svn/asterisk/trunk@81361 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_config_pgsql.c')
-rw-r--r-- | res/res_config_pgsql.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c index 8bd2322d1..dc1d8a02c 100644 --- a/res/res_config_pgsql.c +++ b/res/res_config_pgsql.c @@ -175,12 +175,12 @@ static struct ast_variable *realtime_pgsql(const char *database, const char *tab chunk = strsep(&stringp, ";"); if (!ast_strlen_zero(ast_strip(chunk))) { if (prev) { - prev->next = ast_variable_new(fieldnames[i], chunk); + prev->next = ast_variable_new(fieldnames[i], chunk, ""); if (prev->next) { prev = prev->next; } } else { - prev = var = ast_variable_new(fieldnames[i], chunk); + prev = var = ast_variable_new(fieldnames[i], chunk, ""); } } } @@ -313,7 +313,7 @@ static struct ast_config *realtime_multi_pgsql(const char *database, const char for (rowIndex = 0; rowIndex < num_rows; rowIndex++) { var = NULL; - if (!(cat = ast_category_new(""))) + if (!(cat = ast_category_new("","",99999))) continue; for (i = 0; i < numFields; i++) { stringp = PQgetvalue(result, rowIndex, i); @@ -323,7 +323,7 @@ static struct ast_config *realtime_multi_pgsql(const char *database, const char if (initfield && !strcmp(initfield, fieldnames[i])) { ast_category_rename(cat, chunk); } - var = ast_variable_new(fieldnames[i], chunk); + var = ast_variable_new(fieldnames[i], chunk, ""); ast_variable_append(cat, var); } } @@ -615,8 +615,8 @@ static int destroy_pgsql(const char *database, const char *table, const char *ke static struct ast_config *config_pgsql(const char *database, const char *table, - const char *file, struct ast_config *cfg, - struct ast_flags flags) + const char *file, struct ast_config *cfg, + struct ast_flags flags, const char *suggested_incl) { PGresult *result = NULL; long num_rows; @@ -681,7 +681,7 @@ static struct ast_config *config_pgsql(const char *database, const char *table, char *field_var_val = PQgetvalue(result, rowIndex, 2); char *field_cat_metric = PQgetvalue(result, rowIndex, 3); if (!strcmp(field_var_name, "#include")) { - if (!ast_config_internal_load(field_var_val, cfg, flags)) { + if (!ast_config_internal_load(field_var_val, cfg, flags, "")) { PQclear(result); ast_mutex_unlock(&pgsql_lock); return NULL; @@ -690,14 +690,14 @@ static struct ast_config *config_pgsql(const char *database, const char *table, } if (strcmp(last, field_category) || last_cat_metric != atoi(field_cat_metric)) { - cur_cat = ast_category_new(field_category); + cur_cat = ast_category_new(field_category, "", 99999); if (!cur_cat) break; strcpy(last, field_category); last_cat_metric = atoi(field_cat_metric); ast_category_append(cfg, cur_cat); } - new_v = ast_variable_new(field_var_name, field_var_val); + new_v = ast_variable_new(field_var_name, field_var_val, ""); ast_variable_append(cur_cat, new_v); } } else { |