res_config_pgsql: Fix ast_update2_realtime calls.

Fix so multiple updates from a single call works (add missing ',').
Remove bogus ast_free's that weren't supposed to be there.
Moved a few spaces for readability.

Review: https://reviewboard.asterisk.org/r/3194/
........

Merged revisions 407873 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 407874 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 407875 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407876 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Walter Doekes
2014-02-10 16:49:40 +00:00
parent 75edef52e0
commit 72bf9b1315

View File

@@ -852,7 +852,6 @@ static int update2_pgsql(const char *database, const char *tablename, const stru
if (pgresult) { if (pgresult) {
ast_log(LOG_ERROR, "PostgreSQL RealTime: detected invalid input: '%s'\n", field->value); ast_log(LOG_ERROR, "PostgreSQL RealTime: detected invalid input: '%s'\n", field->value);
release_table(table); release_table(table);
ast_free(sql);
return -1; return -1;
} }
ast_str_append(&where, 0, "%s %s='%s'", first ? "" : " AND", field->name, ast_str_buffer(escapebuf)); ast_str_append(&where, 0, "%s %s='%s'", first ? "" : " AND", field->name, ast_str_buffer(escapebuf));
@@ -883,11 +882,11 @@ static int update2_pgsql(const char *database, const char *tablename, const stru
if (pgresult) { if (pgresult) {
ast_log(LOG_ERROR, "PostgreSQL RealTime: detected invalid input: '%s'\n", field->value); ast_log(LOG_ERROR, "PostgreSQL RealTime: detected invalid input: '%s'\n", field->value);
release_table(table); release_table(table);
ast_free(sql);
return -1; return -1;
} }
ast_str_append(&sql, 0, "%s %s='%s'", first ? "" : ",", field->name, ast_str_buffer(escapebuf)); ast_str_append(&sql, 0, "%s %s='%s'", first ? "" : ",", field->name, ast_str_buffer(escapebuf));
first = 0;
} }
release_table(table); release_table(table);