[Freeswitch-svn] [commit] r4933 - freeswitch/trunk/src/mod/applications/mod_commands

Freeswitch SVN anthm at freeswitch.org
Fri Apr 13 21:52:43 EDT 2007


Author: anthm
Date: Fri Apr 13 21:52:42 2007
New Revision: 4933

Modified:
   freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c

Log:
update

Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	Fri Apr 13 21:52:42 2007
@@ -844,7 +844,7 @@
 	}
 
 	snprintf(id, sizeof(id), "%d", holder->rows);
-	switch_xml_set_attr_d(row, "id", id);
+	switch_xml_set_attr_d(row, "row_id", id);
 
 	for(x = 0; x < argc; x++) {
 		if ((field = switch_xml_add_child_d(row, columnNames[x], f_off++))) {
@@ -990,15 +990,19 @@
 	} else if (!strcasecmp(as, "xml")) {
 		switch_core_db_exec(db, sql, show_as_xml_callback, &holder, &errmsg);
 		if (holder.xml) {
+			char count[50];
+			snprintf(count, sizeof(count), "%d", holder.count);
+			switch_xml_set_attr_d(holder.xml, "row_count", count);
 			char *xmlstr = switch_xml_toxml(holder.xml);
+
 			if (xmlstr) {
 				holder.stream->write_function(holder.stream, "%s", xmlstr);
 				free(xmlstr);
 			} else {
-				holder.stream->write_function(holder.stream, "ERROR\n");
+				holder.stream->write_function(holder.stream, "<result row_count=\"0\"/>\n");
 			}
 		} else {
-			holder.stream->write_function(holder.stream, "ERROR\n");
+			holder.stream->write_function(holder.stream, "<result row_count=\"0\"/>\n");
 		}
 	} else {
 		holder.stream->write_function(holder.stream, "Cannot find format %s\n", as);



More information about the Freeswitch-svn mailing list