Skip to content

Commit 85712da

Browse files
committed
Mike Ansley's fixes for long queries. This change just
corrects flex myinput() routine so that it doesn't assume there is only one bufferload of data. We still have the issue of getting rid of YY_USES_REJECT so that the scanner can cope with tokens larger than its initial buffer size.
1 parent f1de4f9 commit 85712da

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

src/backend/parser/scan.l

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.52 1999/07/17 20:17:26 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.53 1999/09/07 00:13:27 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -491,11 +491,8 @@ int
491491
input()
492492
{
493493
if (parseCh == NULL)
494-
{
495494
parseCh = parseString;
496-
return(*parseCh++);
497-
}
498-
else if (*parseCh == '\0')
495+
if (*parseCh == '\0')
499496
return(0);
500497
else
501498
return(*parseCh++);
@@ -520,20 +517,17 @@ myinput(char* buf, int max)
520517
int len, copylen;
521518

522519
if (parseCh == NULL)
523-
{
524-
len = strlen(parseString);
525-
if (len >= max)
526-
copylen = max - 1;
527-
else
528-
copylen = len;
529-
if (copylen > 0)
530-
memcpy(buf, parseString, copylen);
531-
buf[copylen] = '\0';
532520
parseCh = parseString;
533-
return copylen;
534-
}
521+
len = strlen(parseCh); /* remaining data available */
522+
if (len >= max)
523+
copylen = max - 1;
535524
else
536-
return 0; /* end of string */
525+
copylen = len;
526+
if (copylen > 0)
527+
memcpy(buf, parseCh, copylen);
528+
buf[copylen] = '\0';
529+
parseCh += copylen;
530+
return copylen;
537531
}
538532
#endif /* FLEX_SCANNER */
539533

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy