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

Niels Nes Niels.Nes at cwi.nl
Mon Aug 14 18:55:00 CEST 2006

On Wed, Aug 09, 2006 at 03:13:13PM -0400, Luis Zarrabeitia wrote:
> I wanted to open a feature request for this, but it seems I forgot my 
> sourceforge password.
Many thanks for your patches.
> I attach two patches (cvs -uN):
I aplied the interactive patch. Not the '\.' copyfrom patch, as it
changes a sql specific issue in MapiClient which is a more general tool
(also for xquery and mil/mal).
I made some more changes in the sql frontend and ascii_io library to solve
the proces | MapiClient problem with out '\.' (just end of file should do). 

> =====  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 
> stdin.
> before: 
> $ MapiClient -l sql -i -s "copy 1 records into v from stdin"
> sql>dfjk
> Segmentation fault
> after:
> $ MapiClient -l sql -i -s "copy 1 records into v from stdin"
> more>dfjk
> [ 1     ]
> sql>
> 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.
> Cheers,
> Zarrabeitia.

> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Monetdb-developers mailing list
> Monetdb-developers at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-developers


Niels Nes, Centre for Mathematics and Computer Science (CWI)
Kruislaan 413, 1098 SJ Amsterdam, The Netherlands
room C0.02,  phone ++31 20 592-4098, fax ++31 20 592-4312
url: http://www.cwi.nl/~niels   e-mail: Niels.Nes at cwi.nl

More information about the developers-list mailing list