[asterisk-commits] file: branch file/res_sorcery_realtime r384240 - /team/file/res_sorcery_realt...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 28 06:31:17 CDT 2013


Author: file
Date: Thu Mar 28 06:31:08 2013
New Revision: 384240

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384240
Log:
Trick realtime into providing all rows if requested.

Modified:
    team/file/res_sorcery_realtime/res/res_sorcery_realtime.c

Modified: team/file/res_sorcery_realtime/res/res_sorcery_realtime.c
URL: http://svnview.digium.com/svn/asterisk/team/file/res_sorcery_realtime/res/res_sorcery_realtime.c?view=diff&rev=384240&r1=384239&r2=384240
==============================================================================
--- team/file/res_sorcery_realtime/res/res_sorcery_realtime.c (original)
+++ team/file/res_sorcery_realtime/res/res_sorcery_realtime.c Thu Mar 28 06:31:08 2013
@@ -137,9 +137,24 @@
 {
 	const char *family = data;
 	RAII_VAR(struct ast_config *, rows, NULL, ast_config_destroy);
+	RAII_VAR(struct ast_variable *, all, NULL, ast_variables_destroy);
 	char *row = NULL;
 
-	if (!fields || !(rows = ast_load_realtime_multientry_fields(family, fields))) {
+	if (!fields) {
+		char field[strlen(UUID_FIELD) + 6], value[2];
+
+		/* If no fields have been specified we want all rows, so trick realtime into doing it */
+		snprintf(field, sizeof(field), "%s LIKE", UUID_FIELD);
+		snprintf(value, sizeof(value), "%%");
+
+		if (!(all = ast_variable_new(field, value, ""))) {
+			return;
+		}
+
+		fields = all;
+	}
+
+	if (!(rows = ast_load_realtime_multientry_fields(family, fields))) {
 		return;
 	}
 




More information about the asterisk-commits mailing list