[Monetdb-developers] [Monetdb-checkins] MonetDB5/src/modules/mal tablet_sql.mx, Feb2010, 1.44, 1.44.2.1

Sjoerd Mullender sjoerd at acm.org
Sun Apr 25 23:02:51 CEST 2010


Should I build a new release candidate with this fix included?

On 2010-04-25 12:07, Niels Nes wrote:
> Update of /cvsroot/monetdb/MonetDB5/src/modules/mal
> In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv6881/src/modules/mal
> 
> Modified Files:
>       Tag: Feb2010
> 	tablet_sql.mx 
> Log Message:
> fixed bug in loader, now (again) we handle embedded seperators properly
> 
> 
> Index: tablet_sql.mx
> ===================================================================
> RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/tablet_sql.mx,v
> retrieving revision 1.44
> retrieving revision 1.44.2.1
> diff -u -d -r1.44 -r1.44.2.1
> --- tablet_sql.mx	10 Jan 2010 14:16:36 -0000	1.44
> +++ tablet_sql.mx	25 Apr 2010 10:07:29 -0000	1.44.2.1
> @@ -448,11 +448,10 @@
>  	int res = 0;				/* < 0: error, > 0: success, == 0: continue processing */
>  	int j;
>  	BUN i;
> -	char q=0;
>  	size_t rseplen;
>  	READERtask *task= (READERtask*) GDKzalloc(sizeof(READERtask));
>  	READERtask ptask[16];
> -	int threads= GDKnr_threads < 16? GDKnr_threads: 16;
> +	int threads= (!maxrow || maxrow > (1<<16)) ? (GDKnr_threads < 16? GDKnr_threads: 16):1;
>  	lng lio =0,  tio, t1 = 0, total=0, iototal=0;
>  	int vmtrim = GDK_vm_trim; 
>  
> @@ -603,6 +602,7 @@
>  		   rethink the matter. */
>  		e = s;
>  		while (s < end && (maxrow < 0 || cnt < (BUN) maxrow) ) {
> +			char q=0;
>  			/* tokenize the record completely
>  			   the format of the input should comply to
>  			   the following grammar rule
> @@ -617,55 +617,50 @@
>  			*/
>  			if ( quote == 0) {
>  				if (rseplen == 1)
> -					for ( ; *e ; e++)
> -					{
> +					for ( ; *e ; e++) {
>  						if ( *e == '\\' ){
>  							e++;
>  							continue;
>  						}
>  						if (*e == *rsep ) 
> -								break;
> +							break;
>  					}
>  				else
> -				for ( ; *e ; e++)
> -					{
> +					for ( ; *e ; e++) {
>  						if ( *e == '\\' ) {
>  							e++;
>  							continue;
>  						}
>  						if (*e == *rsep && strncmp(e, rsep, rseplen) == 0)
> -								break;
> +							break;
>  					}
>  				if ( *e == 0) 
>  					e = 0;	/* nonterminated record, we need more */
> -			} else
> -			if ( rseplen == 1 ) {
> -				for ( ; *e ; e++) 
> -				{
> +			} else if ( rseplen == 1 ) {
> +				for ( ; *e ; e++) {
>  					if (*e == q)
> -                        q = 0;
> -                    else if (*e == quote)
> -                        q = *e;
> -                    else if (*e == '\\') {
> -                        if (e[1])
> -                            e++;
> -					} else if (*e == *rsep )
> -							break;
> +                        			q = 0;
> +                    			else if (*e == quote)
> +                        			q = *e;
> +                    			else if (*e == '\\') {
> +                        			if (e[1])
> +                            				e++;
> +					} else if (!q && *e == *rsep )
> +						break;
>  				}
>  				if ( *e == 0) 
>  					e = 0;	/* nonterminated record, we need more */
>  			} else {
> -				for ( ; *e ; e++) 
> -				{
> +				for ( ; *e ; e++) {
>  					if (*e == q)
> -                        q = 0;
> -                    else if (*e == quote)
> -                        q = *e;
> -                    else if (*e == '\\') {
> -                        if (e[1])
> -                            e++;
> -					} else if (*e == *rsep && strncmp(e, rsep, rseplen) == 0 ) 
> -							break;
> +                        			q = 0;
> +                    			else if (*e == quote)
> +                        			q = *e;
> +                    			else if (*e == '\\') {
> +                        			if (e[1])
> +                            				e++;
> +					} else if (!q && *e == *rsep && strncmp(e, rsep, rseplen) == 0 ) 
> +						break;
>  				}
>  				if (*e == 0 )
>  					e = 0;	/* nonterminated record, we need more */
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Monetdb-checkins mailing list
> Monetdb-checkins at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-checkins


-- 
Sjoerd Mullender




More information about the developers-list mailing list