diff options
author | seanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-06-29 12:07:31 +0000 |
---|---|---|
committer | seanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-06-29 12:07:31 +0000 |
commit | 530ed017d35be1a66a83969fb49d1e08ea6c40bc (patch) | |
tree | 29714bc906c9954339829b93c24ceb8f4d8a237b /cdr | |
parent | eecf5ec75cbde50d7fd4a67fe951463097928d9e (diff) |
Merged revisions 126274 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r126274 | seanbright | 2008-06-29 08:06:46 -0400 (Sun, 29 Jun 2008) | 6 lines
Quote column names when inserting CDRs into postgres to avoid conflicts
with reserved words.
(closes issue #12947)
Reported by: panolex
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@126275 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr')
-rw-r--r-- | cdr/cdr_pgsql.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c index f06eee881..7a9258072 100644 --- a/cdr/cdr_pgsql.c +++ b/cdr/cdr_pgsql.c @@ -146,8 +146,8 @@ static int pgsql_log(struct ast_cdr *cdr) if (!value) { if (cur->notnull && !cur->hasdefault) { /* Field is NOT NULL (but no default), must include it anyway */ - LENGTHEN_BUF1(strlen(cur->name)); - lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", cur->name); + LENGTHEN_BUF1(strlen(cur->name) + 2); + lensql += snprintf(sql + lensql, sizesql - lensql, "\"%s\",", cur->name); LENGTHEN_BUF2(3); strcat(sql2, "'',"); lensql2 += 3; @@ -155,8 +155,8 @@ static int pgsql_log(struct ast_cdr *cdr) continue; } - LENGTHEN_BUF1(strlen(cur->name)); - lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", cur->name); + LENGTHEN_BUF1(strlen(cur->name) + 2); + lensql += snprintf(sql + lensql, sizesql - lensql, "\"%s\",", cur->name); if (strcmp(cur->name, "start") == 0 || strcmp(cur->name, "calldate") == 0) { if (strncmp(cur->type, "int", 3) == 0) { |