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

Commitb9d6038

Browse files
committed
Simplify signature of CopyAttributeOutCSV() in copyto.c
This has come up in2889fd2, reverted later on, and is still usefulon its own to reduce a bit the differences between the code pathsdedicated to CSV and text.Discussion:https://postgr.es/m/ZcCKwAeFrlOqPBuN@paquier.xyz
1 parent1aa8324 commitb9d6038

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

‎src/backend/commands/copyto.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static void ClosePipeToProgram(CopyToState cstate);
119119
staticvoidCopyOneRowTo(CopyToStatecstate,TupleTableSlot*slot);
120120
staticvoidCopyAttributeOutText(CopyToStatecstate,constchar*string);
121121
staticvoidCopyAttributeOutCSV(CopyToStatecstate,constchar*string,
122-
booluse_quote,boolsingle_attr);
122+
booluse_quote);
123123

124124
/* Low-level communications functions */
125125
staticvoidSendCopyBegin(CopyToStatecstate);
@@ -837,8 +837,7 @@ DoCopyTo(CopyToState cstate)
837837
colname=NameStr(TupleDescAttr(tupDesc,attnum-1)->attname);
838838

839839
if (cstate->opts.csv_mode)
840-
CopyAttributeOutCSV(cstate,colname, false,
841-
list_length(cstate->attnumlist)==1);
840+
CopyAttributeOutCSV(cstate,colname, false);
842841
else
843842
CopyAttributeOutText(cstate,colname);
844843
}
@@ -952,8 +951,7 @@ CopyOneRowTo(CopyToState cstate, TupleTableSlot *slot)
952951
value);
953952
if (cstate->opts.csv_mode)
954953
CopyAttributeOutCSV(cstate,string,
955-
cstate->opts.force_quote_flags[attnum-1],
956-
list_length(cstate->attnumlist)==1);
954+
cstate->opts.force_quote_flags[attnum-1]);
957955
else
958956
CopyAttributeOutText(cstate,string);
959957
}
@@ -1139,14 +1137,15 @@ CopyAttributeOutText(CopyToState cstate, const char *string)
11391137
*/
11401138
staticvoid
11411139
CopyAttributeOutCSV(CopyToStatecstate,constchar*string,
1142-
booluse_quote,boolsingle_attr)
1140+
booluse_quote)
11431141
{
11441142
constchar*ptr;
11451143
constchar*start;
11461144
charc;
11471145
chardelimc=cstate->opts.delim[0];
11481146
charquotec=cstate->opts.quote[0];
11491147
charescapec=cstate->opts.escape[0];
1148+
boolsingle_attr= (list_length(cstate->attnumlist)==1);
11501149

11511150
/* force quoting if it matches null_print (before conversion!) */
11521151
if (!use_quote&&strcmp(string,cstate->opts.null_print)==0)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp