Martin Kersten wrote:
Sjoerd Mullender wrote:
Is this correct? What about the case where you have a field which ends in \\, such as \\,more data indeed a tricky one... That one was not covered in the old code either. The only other reasonable solution is to disallow any escaping of col/rec separators all together or to rely on the user to deal with these corner cases
I would have thought it's fairly simple: \ escapes the next character. If the next character is in the set [nbtfa] and perhaps [0-7] the combination has a special meaning (newline, backspace, etc), but otherwise you just get the next character, whether it is a \ or the separator. You could have the rule that the \ is only recognized as escape if it is inside a double-quoted string.
which is two fields separated by a comma.
On 2009-08-14 08:17, Martin Kersten wrote:
Update of /cvsroot/monetdb/MonetDB5/src/modules/mal In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv11440
Modified Files: tablet.mx Log Message: Only start looking at the escape if you really have to.
U tablet.mx Index: tablet.mx =================================================================== RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/tablet.mx,v retrieving revision 1.226 retrieving revision 1.227 diff -u -d -r1.226 -r1.227 --- tablet.mx 14 Aug 2009 05:50:11 -0000 1.226 +++ tablet.mx 14 Aug 2009 06:17:10 -0000 1.227 @@ -2278,21 +2278,21 @@ /* we split based on simple character separators for speed */ if ( rseplen == 1 ){ for (; *e; e++) - if ( *e == '\\') - e++; - else - if ( *e == *rsep) + if ( *e == *rsep) { + if ( e> s&& *(e-1) == '\\') + continue; break; + } if (*e == 0) e = 0; } else do { for ( ; *e ; e++) - if ( *e == '\\') - e++; - else - if ( *e == *rsep&& strncmp(e,rsep,rseplen) == 0 ) + if ( *e == *rsep&& strncmp(e,rsep,rseplen) == 0 ) { + if ( e> s&& *(e-1) == '\\') + continue; break; + }
if ( *e ) break; e = 0;
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Monetdb-checkins mailing list Monetdb-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Monetdb-developers mailing list Monetdb-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-developers
-- Sjoerd Mullender