Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit22da903

Browse files
committed
Disable doubling of backslashes in PQprint, per discussion
on pgsql-interfaces a couple months ago.
1 parent280acf0 commit22da903

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

‎src/interfaces/libpq/fe-print.c

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* didn't really belong there.
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.12 1998/09/01 04:40:09 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.13 1998/10/04 20:46:39 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -548,6 +548,7 @@ do_field(PQprintOpt *po, PGresult *res,
548548

549549
if (!skipit)
550550
{
551+
charch=0;
551552
#ifdefMULTIBYTE
552553
intlen;
553554

@@ -558,18 +559,36 @@ do_field(PQprintOpt *po, PGresult *res,
558559
for (p=pval,o=buf;*p;*(o++)=*(p++))
559560
#endif
560561
{
561-
if ((fs_len==1&& (*p==*(po->fieldSep)))||*p=='\\'||*p=='\n')
562+
ch=*p;
563+
/*
564+
* Consensus on pgsql-interfaces (as of Aug 1998) seems to be that
565+
* the print functions ought not insert backslashes. If you like
566+
* them, you can re-enable this next bit.
567+
*/
568+
#ifdefGRATUITOUS_BACKSLASHES
569+
if ((fs_len==1&& (ch==*(po->fieldSep)))||
570+
ch=='\\'||ch=='\n')
562571
*(o++)='\\';
563-
if (po->align&& (*pval=='E'||*pval=='e'||
564-
!((*p >='0'&&*p <='9')||
565-
*p=='.'||
566-
*p=='E'||
567-
*p=='e'||
568-
*p==' '||
569-
*p=='-')))
572+
#endif
573+
if (po->align&&
574+
!((ch >='0'&&ch <='9')||
575+
ch=='.'||
576+
ch=='E'||
577+
ch=='e'||
578+
ch==' '||
579+
ch=='-'))
570580
fieldNotNum[j]=1;
571581
}
572582
*o='\0';
583+
/*
584+
* Above loop will believe E in first column is numeric; also, we
585+
* insist on a digit in the last column for a numeric. This test
586+
* is still not bulletproof but it handles most cases.
587+
*/
588+
if (po->align&&
589+
(*pval=='E'||*pval=='e'||
590+
!(ch >='0'&&ch <='9')))
591+
fieldNotNum[j]=1;
573592
if (!po->expanded&& (po->align||po->html3))
574593
{
575594
intn=strlen(buf);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp