Module: kamailio Branch: master Commit: dab5615c3f513d350c86e86bd5acbdc1bf2a0193 URL: https://github.com/kamailio/kamailio/commit/dab5615c3f513d350c86e86bd5acbdc1...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2016-10-10T12:39:43+02:00
db_unixodbc: added new parameter - quote_char
- specify the character to be used for quoting column and table names in database query
---
Modified: modules/db_unixodbc/db_unixodbc.c Modified: modules/db_unixodbc/dbase.c
---
Diff: https://github.com/kamailio/kamailio/commit/dab5615c3f513d350c86e86bd5acbdc1... Patch: https://github.com/kamailio/kamailio/commit/dab5615c3f513d350c86e86bd5acbdc1...
---
diff --git a/modules/db_unixodbc/db_unixodbc.c b/modules/db_unixodbc/db_unixodbc.c index 020ea5e..84aadc7 100644 --- a/modules/db_unixodbc/db_unixodbc.c +++ b/modules/db_unixodbc/db_unixodbc.c @@ -1,6 +1,4 @@ -/* - * $Id$ - * +/* * UNIXODBC module interface * * Copyright (C) 2005-2006 Marco Lorrai @@ -18,14 +16,11 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * - * History: - * -------- - * 2005-12-01 initial commit (chgen) */
#include "../../sr_module.h" @@ -39,6 +34,8 @@ int auto_reconnect = 1; /* Default is enabled */ int use_escape_common = 0; /* Enable common escaping */ int replace_query = 1; /* Enable ODBC replace query */
+char *db_unixodbc_tquote = NULL; + MODULE_VERSION
int db_unixodbc_bind_api(db_func_t *dbb); @@ -60,12 +57,13 @@ static param_export_t params[] = { {"ping_interval", INT_PARAM, &ping_interval}, {"auto_reconnect", INT_PARAM, &auto_reconnect}, {"use_escape_common", INT_PARAM, &use_escape_common}, - {"replace_query", INT_PARAM, &replace_query}, + {"replace_query", INT_PARAM, &replace_query}, + {"quote_char", PARAM_STRING, &db_unixodbc_tquote}, {0, 0, 0} };
-struct module_exports exports = { +struct module_exports exports = { "db_unixodbc", DEFAULT_DLFLAGS, /* dlopen flags */ cmds, @@ -95,7 +93,7 @@ int db_unixodbc_bind_api(db_func_t *dbb) dbb->raw_query = db_unixodbc_raw_query; dbb->free_result = db_unixodbc_free_result; dbb->insert = db_unixodbc_insert; - dbb->delete = db_unixodbc_delete; + dbb->delete = db_unixodbc_delete; dbb->update = db_unixodbc_update; if (replace_query) dbb->replace = db_unixodbc_replace; diff --git a/modules/db_unixodbc/dbase.c b/modules/db_unixodbc/dbase.c index 3cddfff..38dea56 100644 --- a/modules/db_unixodbc/dbase.c +++ b/modules/db_unixodbc/dbase.c @@ -169,6 +169,7 @@ static int db_unixodbc_submit_query(const db1_con_t* _h, const str* _s) }
+extern char *db_unixodbc_tquote;
/* * Initialize database module @@ -176,7 +177,10 @@ static int db_unixodbc_submit_query(const db1_con_t* _h, const str* _s) */ db1_con_t* db_unixodbc_init(const str* _url) { - return db_do_init(_url, (void*)db_unixodbc_new_connection); + db1_con_t *c; + c = db_do_init(_url, (void*)db_unixodbc_new_connection); + if(c && db_unixodbc_tquote) CON_TQUOTE(c) = db_unixodbc_tquote; + return c; }
/*