Update of /cvsroot/monetdb/MonetDB4/src/modules/plain
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25293/src/modules/plain

Modified Files:
        ascii_io.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: ascii_io.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB4/src/modules/plain/ascii_io.mx,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- ascii_io.mx 13 Dec 2007 14:50:31 -0000      1.17
+++ ascii_io.mx 14 Dec 2007 12:01:18 -0000      1.18
@@ -907,20 +907,20 @@
 ASCIIload_file(ascii *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 (ascii_io_debug)
                stream_printf(GDKerr, "ASCIIload_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("ASCIIload_file: read error 
(after loading %d records)\n", BATcount(as->format[0].c));
@@ -976,11 +976,11 @@
                        i++;
                        if (ascii_io_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