aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-10-14 00:08:52 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-10-14 00:08:52 +0000
commit4d59ca26413ca59d0b59ae3600ebcc0e204b7018 (patch)
treedefa29805f9479efc7793b15f9e31a97dfe89603 /main
parent1078121ae0495b161d852f75b6cd8e1fb4c55463 (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: http://svn.digium.com/svn/asterisk/trunk@148570 f38db490-d61c-443f-a65b-d21fe96a405b
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);