Update of /cvsroot/monetdb/clients/src/mapiclient
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4502
Modified Files:
MapiClient.mx
Log Message:
If the line we got from the server doesn't start with "mdb>#", we
don't have to check whether it starts with "mdb>#EOD".
In XML formatting, make table and column names optional since they are
not always available.
Index: MapiClient.mx
===================================================================
RCS file: /cvsroot/monetdb/clients/src/mapiclient/MapiClient.mx,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- MapiClient.mx 28 Aug 2007 08:35:17 -0000 1.75
+++ MapiClient.mx 28 Aug 2007 08:42:32 -0000 1.76
@@ -356,10 +356,12 @@
if ((reply = mapi_fetch_line(hdl)) == NULL)
return NULL;
- if (strstr(reply, "mdb>#EOD"))
- setPrompt();
- else if (strncmp(reply, "mdb>#", 5) == 0)
- sprintf(promptbuf, "mdb>");
+ if (strncmp(reply, "mdb>#", 5) == 0) {
+ if (strncmp(reply, "mdb>#EOD", 8) == 0)
+ setPrompt();
+ else
+ sprintf(promptbuf, "mdb>");
+ }
return reply;
}
@@ -379,16 +381,19 @@
XMLrenderer(MapiHdl hdl)
{
int i, fields;
+ char *name;
fprintf(toConsole, "<?xml version='1.0' encoding='UT-8'?>\n");
fprintf(toConsole, "<!DOCTYPE table [\n"
" <!ELEMENT table (row)*>\n" /* a table
consists of zero or more rows */
" <!ELEMENT row (column)+>\n" /* a row
consists of one or more columns */
" <!ELEMENT column (#PCDATA)>\n"
- " <!ATTLIST table name CDATA #REQUIRED>\n" /* a table has
a name */
- " <!ATTLIST column name CDATA #REQUIRED>]>\n"); /* a column has
a name */
+ " <!ATTLIST table name CDATA #IMPLIED>\n" /* a table may
have a name */
+ " <!ATTLIST column name CDATA #IMPLIED>]>\n"); /* a column may
have a name */
fprintf(toConsole, "<table");
- XMLprattr("name", mapi_get_table(hdl, 0));
+ name = mapi_get_table(hdl, 0);
+ if (name != NULL && *name != 0)
+ XMLprattr("name", name);
fprintf(toConsole, ">\n");
while ((fields = fetch_row(hdl)) != 0) {
fprintf(toConsole, "<row>");
@@ -396,7 +401,9 @@
char *data = mapi_fetch_field(hdl, i);
fprintf(toConsole, "<column");
- XMLprattr("name", mapi_get_name(hdl, i));
+ name = mapi_get_name(hdl, i);
+ if (name != NULL && *name != 0)
+ XMLprattr("name", name);
fputc('>', toConsole);
if (data)
XMLprdata(data);
@@ -530,7 +537,7 @@
while ((reply = fetch_line(hdl))) {
cnt++;
fprintf(toConsole, "%s\n", reply);
- if (strncmp(reply, "mdb>#EOD", 7) == 0) {
+ if (strncmp(reply, "mdb>#EOD", 8) == 0) {
cnt = 0;
break;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins