summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2008-10-14 00:08:52 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2008-10-14 00:08:52 +0000
commitc1351ad2370f179e439adf9faf9c49cf34a9b4d6 (patch)
treedefa29805f9479efc7793b15f9e31a97dfe89603 /main
parentdb7299f4bc0dd35fb08038a368c6d8700a8ce4d4 (diff)
Merge realtime_update2 branch, which adds a new realtime API call named
'update2', which permits updates which match across multiple columns, instead of requiring all tables to have a single unique identifier. All of the other API calls with the exception of 'update' already had the ability to match on multiple fields, so it was a missing and very desireable feature that an API call implementing an update should have this, too. This does not change any outward performance of Asterisk, but it should make life easier for application developers who use the RealTime framework. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@148570 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/config.c47
1 files changed, 32 insertions, 15 deletions
diff --git a/main/config.c b/main/config.c
index 5ea68a7a7..986c81571 100644
--- a/main/config.c
+++ b/main/config.c
@@ -2069,8 +2069,8 @@ struct ast_config *ast_config_load2(const char *filename, const char *who_asked,
static struct ast_variable *ast_load_realtime_helper(const char *family, va_list ap)
{
struct ast_config_engine *eng;
- char db[256]="";
- char table[256]="";
+ char db[256];
+ char table[256];
struct ast_variable *res=NULL;
eng = find_engine(family, db, sizeof(db), table, sizeof(table));
@@ -2141,8 +2141,8 @@ int ast_realtime_enabled()
int ast_realtime_require_field(const char *family, ...)
{
struct ast_config_engine *eng;
- char db[256] = "";
- char table[256] = "";
+ char db[256];
+ char table[256];
va_list ap;
int res = -1;
@@ -2159,8 +2159,8 @@ int ast_realtime_require_field(const char *family, ...)
int ast_unload_realtime(const char *family)
{
struct ast_config_engine *eng;
- char db[256] = "";
- char table[256] = "";
+ char db[256];
+ char table[256];
int res = -1;
eng = find_engine(family, db, sizeof(db), table, sizeof(table));
@@ -2173,9 +2173,9 @@ int ast_unload_realtime(const char *family)
struct ast_config *ast_load_realtime_multientry(const char *family, ...)
{
struct ast_config_engine *eng;
- char db[256]="";
- char table[256]="";
- struct ast_config *res=NULL;
+ char db[256];
+ char table[256];
+ struct ast_config *res = NULL;
va_list ap;
va_start(ap, family);
@@ -2191,8 +2191,8 @@ int ast_update_realtime(const char *family, const char *keyfield, const char *lo
{
struct ast_config_engine *eng;
int res = -1;
- char db[256]="";
- char table[256]="";
+ char db[256];
+ char table[256];
va_list ap;
va_start(ap, lookup);
@@ -2204,12 +2204,29 @@ int ast_update_realtime(const char *family, const char *keyfield, const char *lo
return res;
}
+int ast_update2_realtime(const char *family, ...)
+{
+ struct ast_config_engine *eng;
+ int res = -1;
+ char db[256];
+ char table[256];
+ va_list ap;
+
+ va_start(ap, family);
+ eng = find_engine(family, db, sizeof(db), table, sizeof(table));
+ if (eng && eng->update2_func)
+ res = eng->update2_func(db, table, ap);
+ va_end(ap);
+
+ return res;
+}
+
int ast_store_realtime(const char *family, ...)
{
struct ast_config_engine *eng;
int res = -1;
- char db[256]="";
- char table[256]="";
+ char db[256];
+ char table[256];
va_list ap;
va_start(ap, family);
@@ -2225,8 +2242,8 @@ int ast_destroy_realtime(const char *family, const char *keyfield, const char *l
{
struct ast_config_engine *eng;
int res = -1;
- char db[256]="";
- char table[256]="";
+ char db[256];
+ char table[256];
va_list ap;
va_start(ap, lookup);