Update of /cvsroot/monetdb/sql/src/backends/monet4
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21465/src/backends/monet4

Modified Files:
        sql_result.mx 
Log Message:
fixed leaks 

improved handling of xml attributes without name specification
(todo add dynamic checks for valid xml attribute names)

made copy into file adher to the specified quotes.



Index: sql_result.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet4/sql_result.mx,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- sql_result.mx       3 Jan 2008 09:41:17 -0000       1.76
+++ sql_result.mx       5 Jan 2008 10:48:47 -0000       1.77
@@ -388,7 +388,7 @@
 {
        ascii_io *c = extra;
 
-       if (s == NULL || s == e || (!quote && 
+       if (s == NULL || (!quote && s == e) || (!quote && 
                        (s[0] == 'N' || s[0] == 'n') &&
                        (s[1] == 'U' || s[1] == 'u') &&
                        (s[2] == 'L' || s[2] == 'l') &&
@@ -409,8 +409,6 @@
 static int
 _ASCIIadt_toStr(void *extra, char **buf, int *len, int type, ptr a)
 {
-
-       (void) extra;
        if (!a || ATOMcmp(type, ATOMnilptr(type), a) == 0) {
                char *dst;
                const char src[] = "NULL";
@@ -425,6 +423,30 @@
                strncpy(dst, src, l);
                dst[l] = 0;
                return l;
+       } else if (type == TYPE_str) {
+               ascii_io *fmt = (ascii_io*)extra;
+               char *dst, *src = a;
+               int l = escapedStrlen(src), l2 = 0;
+
+               if (l + 3 > *len) {
+                       GDKfree(*buf);
+                       *len = 2 * l + 3;
+                       *buf = GDKmalloc(*len);
+               }
+               dst = *buf;
+               if (fmt->quote) {
+                       dst[0] = fmt->quote;
+                       l2 = 1;
+                       l = escapedStr(dst+l2, src);
+               } else {
+                       strncpy(dst + l2, src, l);
+               }
+               if (l2) {
+                       dst[l + l2] = fmt->quote;
+                       l2++;
+               }
+               dst[l + l2] = 0;
+               return l + l2;
        } else {
                return (*BATatoms[type].atomToStr) (buf, len, a);
        }
@@ -783,6 +805,8 @@
                        fmt[i].tostr = &sql_time_tostr;
                        fmt[i].frstr = NULL;
                        fmt[i].extra = ts_res;
+               } else {
+                       fmt[i].extra = fmt+i;
                }
        }
        if (i == t->nr_cols + 1) {


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to