Update of /cvsroot/monetdb/MonetDB5/src/modules/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28449/src/modules/mal

Modified Files:
        tablet.mx 
Log Message:
offset is now from 0 (as the rest of the ascii_io code expects this)
(we correct the sql row number [1..) offsets into c number schemes)



Index: tablet.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/tablet.mx,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- tablet.mx   13 Dec 2007 14:57:20 -0000      1.109
+++ tablet.mx   14 Dec 2007 12:03:53 -0000      1.110
@@ -1509,20 +1509,20 @@
 TABLETload_file(Tablet * as, bstream *b, stream *out)
 {
        int res = 0, done = 0;
-       size_t i = 1;
+       size_t i = 0;
        char *sep = as->format[as->nr_attrs - 1].sep;
        int seplen = as->format[as->nr_attrs - 1].seplen;
-       size_t nr = as->offset + as->nr;
        size_t offset = as->offset;
+       size_t nr = offset + as->nr;
 
        if (tablet_debug)
                stream_printf(GDKerr, "TABLETload_file\n");
 
-       while ((b->pos < b->len || !b->eof) && res == 0 && (nr == ~(size_t) 0 
|| i <= nr)) {
+       while ((b->pos < b->len || !b->eof) && res == 0 && (nr == ~(size_t) 0 
|| i < nr)) {
                char *s, *end;
 
                if (b->pos >= b->len && read_more(b, out, b->size - (b->len - 
b->pos)) == EOF) {
-                       if (nr != ~(size_t)0 && i <= nr) {
+                       if (nr != ~(size_t)0 && i < nr) {
                                res = 1; 
                                if (b->len > b->pos) {
                                        GDKerror("TABLETload_file: read error 
(after loading %d records)\n", BATcount(as->format[0].c));
@@ -1582,11 +1582,11 @@
                        i++;
                        if (tablet_debug && (i % 100000) == 0)
                                stream_printf(GDKerr, "inserted " SZFMT "\n", 
i);
-                       if (nr != ~(size_t) 0 && i > nr)
+                       if (nr != ~(size_t) 0 && i >= nr)
                                break;
                }
        }
-       as->nr = i-as->offset-1;
+       as->nr = i-offset;
        if (res < 0)
                return res;
        return (ssize_t) as->nr;


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to