Changeset: 29e91cf9f4f1 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=29e91cf9f4f1
Modified Files:
        sql/backends/monet5/sql_result.mx
Branch: Dec2011
Log Message:

Copy result to correct buffer.
This partially fixes bug 2963 in that now nil time values are now
actually reported as nil.


diffs (20 lines):

diff --git a/sql/backends/monet5/sql_result.mx 
b/sql/backends/monet5/sql_result.mx
--- a/sql/backends/monet5/sql_result.mx
+++ b/sql/backends/monet5/sql_result.mx
@@ -158,8 +158,15 @@ sql_time_tostr(void *TS_RES, char **buf,
        tmp = (daytime) val;
 
        len1 = daytime_tostr(&s1, &big, &tmp);
-       if (len1 == 3 && strcmp(s1, "nil") == 0) 
+       if (len1 == 3 && strcmp(s1, "nil") == 0) {
+               if (*len < 4 || *buf == NULL) {
+                       if (*buf)
+                               GDKfree(*buf);
+                       *buf = (str) GDKmalloc(*len = 4);
+               }
+               strcpy(*buf, s1);
                return len1;
+       }
 
        /* fixup the fraction, default is 3 */
        len1 += (ts_res->fraction-3);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to