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

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/monet5/sql_result.mx,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- sql_result.mx       4 Jan 2008 17:58:49 -0000       1.77
+++ sql_result.mx       5 Jan 2008 10:48:48 -0000       1.78
@@ -412,7 +412,7 @@
 {
        Column *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') &&
@@ -433,8 +433,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";
@@ -449,6 +447,30 @@
                strncpy(dst, src, l);
                dst[l] = 0;
                return l;
+       } else if (type == TYPE_str) {
+               Column *fmt = (Column*)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);
        }
@@ -814,6 +836,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