[Asterisk-code-review] cel pgsql: Fix schema query for get columns name (asterisk[master])
Matt Jordan
asteriskteam at digium.com
Sun Apr 19 14:28:37 CDT 2015
Matt Jordan has posted comments on this change.
Change subject: cel_pgsql: Fix schema query for get columns name
......................................................................
Patch Set 1:
(1 comment)
https://gerrit.asterisk.org/#/c/120/1/cel/cel_pgsql.c
File cel/cel_pgsql.c:
Line 562: /* Escape special characters in schemaname */
: if (strchr(schemaname, '\\') || strchr(schemaname, '\'')) {
: char *tmp = schemaname, *ptr;
:
: ptr = schemaname = ast_alloca(strlen(tmp) * 2 + 1);
: for (; *tmp; tmp++) {
: if (strchr("\\'", *tmp)) {
: *ptr++ = *tmp;
: }
: *ptr++ = *tmp;
: }
: *ptr = '\0';
: }
: /* Escape special characters in tablename */
: if (strchr(tablename, '\\') || strchr(tablename, '\'')) {
: char *tmp = tablename, *ptr;
:
: ptr = tablename = ast_alloca(strlen(tmp) * 2 + 1);
: for (; *tmp; tmp++) {
: if (strchr("\\'", *tmp)) {
: *ptr++ = *tmp;
: }
: *ptr++ = *tmp;
: }
: *ptr = '\0';
: }
> Where is do you thinks is the best place for this function?,
If this function is generic between both cdr_pgsql and cel_pgsql, it should probably belong in strings.h/strings.c. That heads already provides a variety of string escaping functions.
Barring that, simply providing a single function for this code change in cel_pgsql that does the escaping may be sufficient.
--
To view, visit https://gerrit.asterisk.org/120
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I691fd2cbc277fcba10e615f5884f8de5d8152f2c
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Rodrigo Ramirez Norambuena <decipher.hk at gmail.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Rodrigo Ramirez Norambuena <decipher.hk at gmail.com>
Gerrit-HasComments: Yes
More information about the asterisk-code-review
mailing list