[Monetdb-developers] [PATCH] MapiClient bugfix && copy from stdin

Luis Zarrabeitia kyrie at uh.cu
Wed Aug 9 21:13:13 CEST 2006

I wanted to open a feature request for this, but it seems I forgot my 
sourceforge password.

I attach two patches (cvs -uN):

=====  interactive.patch
It fixes what I would consider a bug in MapiClient: if the '-s' and '-i' 
switches are both given, and the argument to '-s' is not finished in the 
command line (mid->active is not null, i.e, if the -s is a copyfrom 
construct), MapiClient will segfault instead of finishing the command from 

$ MapiClient -l sql -i -s "copy 1 records into v from stdin"
Segmentation fault

$ MapiClient -l sql -i -s "copy 1 records into v from stdin"
[ 1     ]

There is a remaining issue if the copyfrom ends in a semicolon in the -s 
switch, because MapiClient will insert another semicolon after that... I did 
not touch that piece of code buecasue from thhe comments around it, it seemed 
like it was done on purpose.

======= copyfrom.patch
Allows a copy from stdin without specifying the number of records. End of 
input will be marked with a '\.' on an empty line, as in postgres. 
Additionally, if stdin ends (or a ctrl-D is received), MapiClient will feed 
the end-of-input to the backend.

Thus, with both patches applied, it should be now possible to do

myprocess | MapiClient -l sql -i -s "copy into v from stdin"

If interactive is not applied, it should still be possible to do:

( echo "copy into v from stdin;"; myprocess ) | MapiClient -l sql

Please tell me how to proceed.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: copyfrom.patch
Type: text/x-diff
Size: 1763 bytes
Desc: not available
URL: <http://www.monetdb.org/pipermail/developers-list/attachments/20060809/87e8b6e7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interactive.patch
Type: text/x-diff
Size: 1891 bytes
Desc: not available
URL: <http://www.monetdb.org/pipermail/developers-list/attachments/20060809/87e8b6e7/attachment-0001.bin>

More information about the developers-list mailing list