[asterisk-addons-commits] branch 1.2 r258 -
/branches/1.2/app_addon_sql_mysql.c
asterisk-addons-commits at lists.digium.com
asterisk-addons-commits at lists.digium.com
Sun Jul 9 21:14:55 MST 2006
Author: tilghman
Date: Sun Jul 9 23:14:55 2006
New Revision: 258
URL: http://svn.digium.com/view/asterisk-addons?rev=258&view=rev
Log:
Revert previous change as it was not ready
Modified:
branches/1.2/app_addon_sql_mysql.c
Modified: branches/1.2/app_addon_sql_mysql.c
URL: http://svn.digium.com/view/asterisk-addons/branches/1.2/app_addon_sql_mysql.c?rev=258&r1=257&r2=258&view=diff
==============================================================================
--- branches/1.2/app_addon_sql_mysql.c (original)
+++ branches/1.2/app_addon_sql_mysql.c Sun Jul 9 23:14:55 2006
@@ -178,20 +178,20 @@
}
}
-static int set_asterisk_int(struct ast_channel *chan, const char *varname, int id) {
- if (id >= 0) {
- char s[13] = "";
- snprintf(s, sizeof(s), "%d", id);
+static int set_asterisk_int(struct ast_channel *chan, char *varname, int id) {
+ if( id>=0 ) {
+ char s[100] = "";
+ snprintf(s, sizeof(s)-1, "%d", id);
#if EXTRA_LOG
- ast_log(LOG_WARNING, "MYSQL: setting var '%s' to value '%s'\n", varname, s);
+ ast_log(LOG_WARNING,"MYSQL: setting var '%s' to value '%s'\n",varname,s);
#endif
- pbx_builtin_setvar_helper(chan, varname, s);
+ pbx_builtin_setvar_helper(chan,varname,s);
}
return id;
}
static int add_identifier_and_set_asterisk_int(struct ast_channel *chan, char *varname, int identifier_type, void *data) {
- return set_asterisk_int(chan, varname, add_identifier(identifier_type, data));
+ return set_asterisk_int(chan,varname,add_identifier(identifier_type,data));
}
static int safe_scan_int( char** data, char* delim, int def ) {
@@ -227,11 +227,12 @@
if( connid_var && dbhost && dbuser && dbpass && dbname ) {
mysql = mysql_init(NULL);
if (mysql) {
- if (mysql_real_connect(mysql, dbhost, dbuser, dbpass, dbname, 0, NULL, 0)) {
- add_identifier_and_set_asterisk_int(chan, connid_var, AST_MYSQL_ID_CONNID, mysql);
+ if (mysql_real_connect(mysql,dbhost,dbuser,dbpass,dbname,0,NULL,0)) {
+ add_identifier_and_set_asterisk_int(chan,connid_var,AST_MYSQL_ID_CONNID,mysql);
return 0;
- } else {
- ast_log(LOG_WARNING, "mysql_real_connect(mysql,%s,%s,dbpass,%s,...) failed\n", dbhost, dbuser, dbname);
+ }
+ else {
+ ast_log(LOG_WARNING,"mysql_real_connect(mysql,%s,%s,dbpass,%s,...) failed\n",dbhost,dbuser,dbname);
}
}
else {
@@ -415,26 +416,8 @@
int unload_module(void)
{
- int res;
- struct ast_MYSQL_id *i;
- struct MYSQLidshead *headp = &_mysql_ids_head;
-
STANDARD_HANGUP_LOCALUSERS;
- res = ast_unregister_application(app);
-
- /* Dispose of any ids left hanging */
- AST_LIST_LOCK(headp);
- AST_LIST_TRAVERSE_SAFE_BEGIN(headp, i, entries) {
- if (i->identifier_type == AST_MYSQL_ID_RESID)
- mysql_free_result(i->identifier);
- else if (i->identifier_type == AST_MYSQL_ID_CONNID)
- mysql_close(i->identifier);
- AST_LIST_REMOVE_CURRENT(headp, entries);
- free(i);
- }
- AST_LIST_TRAVERSE_SAFE_END;
- AST_LIST_UNLOCK(headp);
- return res;
+ return ast_unregister_application(app);
}
int load_module(void)
More information about the asterisk-addons-commits
mailing list