Thread

  1. Re: [HACKERS] Status report: long-query-string changes

    Leon <leon@udmnet.ru> — 1999-09-12T12:12:02Z

    Tom Lane wrote:
    
    > 
    > If you're looking at the "literal" buffer, that would need to be made
    > expansible, but there's not much point until flex's internal stuff is
    > fixed.
    > 
    > 
    
    Look at this piece of code. It seems that when myinput() had been called
    once, for the second time it will return 0 even if string isn't
    over yet. Parameter 'max' is 8192 bytes on my system. So the query is 
    simply truncated to that size.
    
    #ifdef FLEX_SCANNER
    /* input routine for flex to read input from a string instead of a file */
    static int
    myinput(char* buf, int max)
    {
    	int len, copylen;
    
    	if (parseCh == NULL)
    	{
    		len = strlen(parseString);
    		if (len >= max)
    			copylen = max - 1;
    		else
    			copylen = len;
    		if (copylen > 0)
    			memcpy(buf, parseString, copylen);
    		buf[copylen] = '\0';
    		parseCh = parseString;
    		return copylen;
    	}
    	else
    		return 0; /* end of string */
    }
    #endif /* FLEX_SCANNER */
     
    
    -- 
    Leon.
    -------
    He knows he'll never have to answer for any of his theories actually 
    being put to test. If they were, they would be contaminated by reality.