Update of /cvsroot/monetdb/MonetDB5/src/modules/mal
In directory sc8-pr-cvs16:/tmp/cvs-serv13771

Modified Files:
        tablet.mx 
Log Message:
Support an externally supplied key while parsing a tuple.
It will be used in the Datacell receptors to time stamp each event.


Index: tablet.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/tablet.mx,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- tablet.mx   19 May 2007 12:33:38 -0000      1.87
+++ tablet.mx   20 May 2007 17:24:49 -0000      1.88
@@ -448,7 +448,7 @@
 tablet_export ptr *TABLETstrFrStr(Column *c, char *s, char *e);
 tablet_export ptr *TABLETadt_frStr(void *extra, int type, char *s, char *e, 
char quote);
 tablet_export int TABLETadt_toStr(void *extra, char **buf, int *len, int type, 
ptr a);
-tablet_export int insert_line(Tablet * as, char *line);
+tablet_export int insert_line(Tablet * as, char *line, ptr key);
 
 #endif
 @c
@@ -1213,7 +1213,7 @@
 }
 
 static INLINE int
-insert_val(Column * fmt, char *s, char *e, char quote, str *err)
+insert_val(Column * fmt, char *s, char *e, char quote, ptr key, str *err)
 {
        int res = 0;
        char *end = e;
@@ -1249,7 +1249,10 @@
                return -1;
        }
 
-       res = (BUNappend(fmt->c, adt, FALSE) == NULL);
+       if( key)
+               res = (BUNins(fmt->c, key, adt, FALSE) == NULL);
+       else
+               res = (BUNappend(fmt->c, adt, FALSE) == NULL);
        if (fmt->data != adt)
                GDKfree(adt);
        return res;
@@ -1277,7 +1280,7 @@
 }
 
 INLINE int
-insert_line(Tablet * as, char *line)
+insert_line(Tablet * as, char *line, ptr key)
 {
        int res = 0;
        Column *fmt = as->format;
@@ -1322,7 +1325,7 @@
                if (e) {
                        char *end = e;
 
-                       res |= insert_val(&fmt[i], s, e, quote, &as->error);
+                       res |= insert_val(&fmt[i], s, e, quote, key, 
&as->error);
                        quote = 0;
                        line = end + fmt[i].seplen;
                } else {
@@ -1509,7 +1512,7 @@
 
                        if (e) {
                                *e = '\0';
-                               if (insert_line(as, s) < 0) {
+                               if (insert_line(as, s, NULL) < 0) {
                                        GDKerror(as->error);
                                        as->error=0;
                                        s = e + seplen;
@@ -1531,7 +1534,7 @@
                                                /* some data left? */
                                                res = 1; 
                                                if (b->len > b->pos &&
-                                                   insert_line(as, s) < 0) {
+                                                   insert_line(as, s, NULL) < 
0) {
                                                                
GDKerror(as->error);
                                                                as->error=0;
                                                                
GDKerror("TABLETload_file: read error "


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to