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

Modified Files:
        mal_client.mx 
Log Message:
dirty fix for block mode (from end of block find new line, shift all
characters up to new line add EOS and increment length of read data UGH 
possible problem new line in string)


Index: mal_client.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_client.mx,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -d -r1.157 -r1.158
--- mal_client.mx       5 Sep 2007 18:13:16 -0000       1.157
+++ mal_client.mx       11 Sep 2007 21:56:40 -0000      1.158
@@ -763,9 +763,8 @@
                         in->buf[in->pos] == ';' || !in->buf[in->pos]))
                in->pos++;
 
-       if (in->pos >= in->len) {
+       if (in->pos >= in->len || in->mode) {
                ssize_t rd, sum = 0;
-               assert(in->pos == in->len);
 
                if (in->eof || !isa_block_stream(in->s)) {
                        @:sendPrompt@
@@ -773,8 +772,23 @@
                }
                while ((rd = bstream_next(in)) > 0 && !in->eof) {
                        sum += rd;
-                       if (!in->mode)/* read one line at a time in line mode */
+                       if (!in->mode) {/* read one line at a time in line mode 
*/
                                break;
+                       } else { /* find last new line */
+                               char *p = in->buf+in->len-1;
+
+                               while(p > in->buf && *p != '\n') {
+                                       *(p+1) = *p;
+                                       p--;
+                               }
+                               if (p > in->buf) {
+                                       *(p+1) = 0;
+                               } else {
+                                       in->pos++;
+                               }
+                               if (p != in->buf+ in->len -1)
+                                       in->len++;
+                       }
                }
                if (sum == 0 && in->eof && isa_block_stream(in->s)) {
                        /* we hadn't seen the EOF before, so just try again


-------------------------------------------------------------------------
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-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to