make datastore creation and destruction a generic API since it is not really channel related, and add the ability to add/find/remove datastores to manager sessions

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135680 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2008-08-05 16:56:11 +00:00
parent 8ba981911a
commit 7df8b8b848
25 changed files with 316 additions and 140 deletions

View File

@@ -480,7 +480,7 @@ end_acf_read:
struct ast_datastore *odbc_store;
uid = ast_atomic_fetchadd_int(&resultcount, +1) + 1;
snprintf(buf, len, "%d", uid);
odbc_store = ast_channel_datastore_alloc(&odbc_info, buf);
odbc_store = ast_datastore_alloc(&odbc_info, buf);
if (!odbc_store) {
ast_log(LOG_ERROR, "Rows retrieved, but unable to store it in the channel. Results fail.\n");
odbc_datastore_free(resultset);
@@ -550,7 +550,7 @@ static int acf_fetch(struct ast_channel *chan, const char *cmd, char *data, char
if (!row) {
/* Cleanup datastore */
ast_channel_datastore_remove(chan, store);
ast_channel_datastore_free(store);
ast_datastore_free(store);
return -1;
}
pbx_builtin_setvar_helper(chan, "~ODBCFIELDS~", resultset->names);
@@ -584,7 +584,7 @@ static int exec_odbcfinish(struct ast_channel *chan, void *data)
if (!store) /* Already freed; no big deal. */
return 0;
ast_channel_datastore_remove(chan, store);
ast_channel_datastore_free(store);
ast_datastore_free(store);
return 0;
}